forked from heinervdm/nohands
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhfpd-dbus-doc.cs
2641 lines (2534 loc) · 97.1 KB
/
hfpd-dbus-doc.cs
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*
* Software Bluetooth Hands-Free Implementation
*
* Copyright (C) 2008 Sam Revitch <[email protected]>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
/*
* Using C# here is a hack. C# provides a set of language-level
* features that are relatively close to the way that D-Bus interfaces
* are defined.
*/
/**
* @mainpage D-Bus API for HFPD
*
* The HFP for Linux package provides a service daemon, @c hfpd, that
* performs most of the low-level functions required to implement the
* hands-free side of Bluetooth Hands-Free Profile. The @c hfpd process
* attaches to the D-Bus session bus, and is entirely controlled via
* D-Bus messages. All of its status can be retrieved via D-Bus, and
* changes to its status are notified through D-Bus signals.
*
* The D-Bus APIs are ideally suited for constructing hands-free
* applications using high-level languages, such as Python, C#, or even
* Perl. As a lower level and much more complicated alternative, one
* may use the <a href="../doxy/index.html">libhfp C++ APIs</a>.
*
* The D-Bus APIs described in this document are relatively complete.
* The hfconsole application is implemented entirely in Python, and uses
* dbus-python to access D-Bus APIs described in this document. It does
* not directly depend on BlueZ, and does not use the BlueZ D-Bus APIs or
* Python bindings. The APIs described here, and PyGTK, are the only
* dependencies of hfconsole in order for it to do its job.
*
* @section features HFPD Features
*
* - Supports device scanning, connection, disconnection, and automatic
* reconnection
* - Supports multiple concurrently connected audio gateway devices
* - Resilient to loss of Bluetooth service
* - Supports the ALSA and OSS audio hardware interfaces
* - Supports audio system test modes
* - Supports microphone input cleanup, including echo cancellation and
* noise reduction.
* - Supports simple recording and playback of stored audio files, e.g.
* for recording calls and playing ring tones.
*
* @section access D-Bus Access
*
* A D-Bus client wishing to make use of HFPD must be able to connect to
* D-Bus, and send and receive messages. The simplest way to do this is to
* choose an appropriate D-Bus binding for your language or toolkit. An
* <a href="http://www.freedesktop.org/wiki/Software/DBusBindings">
* updated list of bindings</a> can be found connected to the
* D-Bus home page.
*
* The HFPD process acquires the D-Bus unique name @b @c net.sf.nohands.hfpd .
*
* The install target of the HFP for Linux Makefiles will install a
* D-Bus service description file for HFPD. This allows dbus-daemon to
* start HFPD as needed. D-Bus clients of this API only need to send
* messages to the HFPD unique name in order for HFPD to be started.
* D-Bus clients do not need to be concerned with starting and stopping HFPD
* themselves.
*
* Two known object paths are intended as the primary points of access to
* D-Bus clients:
* - @b @c /net/sf/nohands/hfpd , with interface net.sf.nohands.hfpd.HandsFree
* - @b @c /net/sf/nohands/hfpd/soundio , with interface net.sf.nohands.hfpd.SoundIo
*
* For each known audio gateway device, an object with interface
* net.sf.nohands.hfpd.AudioGateway will be instantiated. A new object
* of this type can be instantiated for an audio gateway device with a
* specific Bluetooth address using net.sf.nohands.hfpd.HandsFree.AddDevice(),
* and the paths of all such objects of this type are enumerated in
* net.sf.nohands.hfpd.HandsFree.AudioGateways.
*
* All interfaces provided by HFPD are introspectable and should be
* usable with most any language binding.
*
* @section property D-Bus Properties
*
* HFPD D-Bus objects make extensive use of the standard D-Bus properties
* interface, <a href="http://dbus.freedesktop.org/doc/dbus-specification.html#standard-interfaces-properties">
* org.freedesktop.DBus.Properties</a>. Ideally, one would
* expect a D-Bus language binding for an object-oriented language to
* expose properties as simple data members of the proxy objects.
* For example, in Python, the following would make a lot of sense to
* set the net.sf.nohands.hfpd.HandsFree.SecMode property on an HFPD
* instance:
*
* @code
* hfpd = dbus.Interface(
* dbus.get_object('net.sf.nohands.hfpd',
* '/net/sf/nohands/hfpd'),
* dbus_interface = 'net.sf.nohands.hfpd.HandsFree')
* hfpd.SecMode = 2
* @endcode
*
* Unfortunately, a number of D-Bus language bindings, including
* dbus-python, skimp on properties and do not provide access to
* properties in the most transparent possible way. Depending on the
* language and bindings package used, a D-Bus client application of HFPD
* may need to take extra measures to access properties, often manually
* invoking @c org.freedesktop.DBus.Properties.Get and
* @c org.freedesktop.DBus.Properties.Set . For example, the above must
* instead be implemented as:
*
* @code
* hfpd = dbus.Interface(
* dbus.get_object('net.sf.nohands.hfpd',
* '/net/sf/nohands/hfpd'),
* dbus_interface = 'net.sf.nohands.hfpd.HandsFree')
* hfpdprop = dbus.Interface(
* dbus.get_object('net.sf.nohands.hfpd',
* '/net/sf/nohands/hfpd'),
* dbus_interface = 'org.freedesktop.DBus.Properties')
* hfpdprop.Set('net.sf.nohands.hfpd.HandsFree', 'SecMode', 2)
* @endcode
*
* For more information on the standard D-Bus properties interface,
* consult the
* <a href="http://dbus.freedesktop.org/doc/dbus-specification.html#standard-interfaces-properties">
* D-Bus specification</a>.
*
* @section clients D-Bus Client Guide
*
* The purpose of an HFPD D-Bus client is to implement the very high-level
* logic of managing audio gateway devices and audio connections, and of
* course, presenting status information to the user. It is possible to
* create a complete D-Bus client for HFPD that is very simple. Such a
* program might implement the following:
* - Keep a private configuration file, and use it to save the Bluetooth
* address of at least one audio gateway device that it is bound to.
* - Connect to HFPD using D-Bus, and claim the device(s) remembered
* in its configuration file using net.sf.nohands.hfpd.HandsFree.AddDevice().
* - For each claimed device:
* - Set the net.sf.nohands.hfpd.AudioGateway.AutoReconnect property
* to @c true.
* - Register to receive the
* net.sf.nohands.hfpd.AudioGateway.AudioStateChanged signal, and use
* the signal handler to start streaming audio to and from the audio
* gateway device, using
* net.sf.nohands.hfpd.SoundIo.AudioGatewayStart(), or failing that,
* close the audio connection with
* net.sf.nohands.hfpd.AudioGateway.CloseAudio().
* - Register to receive the
* net.sf.nohands.hfpd.AudioGateway.StateChanged and
* net.sf.nohands.hfpd.AudioGateway.CallStateChanged signals, and
* use them to display simple status for the audio gateway.
*
* It is also possible to create a D-Bus client that does not claim any
* devices. Such a client might maintain a status display, and either
* depend on another client to claim and manage audio gateway devices, or
* depend on HFPD's list of permanently known audio gateway devices to
* permit incoming connections.
*/
namespace net.sf.nohands.hfpd {
/**
* @brief Main access object for Hands-Free Profile functions
*
* The main access object provides a number of basic functions
* useful for implementing hands-free profile.
*
* The HFPD process will instantiate one object that implements
* this interface at path @b @c /net/sf/nohands/hfpd
*/
interface HandsFree {
/**
* @brief Attempt to start the Bluetooth service
*
* This method will attempt to start the Bluetooth
* service within the HFPD process. This includes
* binding to a local Bluetooth adapter, opening a socket
* to receive incoming HFP service-level connections, and
* registering an SDP record. Unless the service is
* started, Bluetooth devices will not observe the local
* system as implementing the Hands-Free Profile and
* will not be able to use it.
*
* If the Bluetooth service is already started, this
* method will do nothing.
*
* @throw net.sf.nohands.hfpd.Error Thrown for
* uninteresting errors.
* @throw net.sf.nohands.hfpd.Error.BtNoKernelSupport
* Kernel lacks required Bluetooth support.
* @throw net.sf.nohands.hfpd.Error.BtServiceConflict
* Another service has claimed the SCO listening socket.
* @throw net.sf.nohands.hfpd.Error.BtScoConfigError
* The attached HCI has misconfigured SCO settings, which
* can only be resolved by a superuser.
*/
public Start();
/**
* @brief Shut down the Bluetooth service
*
* If the Bluetooth service is started, this method will
* cause it to be stopped. Its SDP record will be
* deregistered, and its listening Bluetooth sockets will
* be closed.
*
* If the Bluetooth service is already stopped, this
* method will do nothing.
*/
public Stop();
/**
* @brief Start inquiry (scan for devices)
*
* Initiates a Bluetooth inquiry to enumerate discoverable
* devices.
*
* When an inquiry is started, it will generate an
* InquiryStateChanged() signal. While it is in progress,
* nearby discoverable devices will be identified and
* reported to D-Bus clients through the InquiryResult()
* signal. After approximately five seconds, the inquiry
* will be terminated, which will cause an
* InquiryStateChanged() signal to be generated.
*
* @throw net.sf.nohands.hfpd.Error Thrown if an
* inquiry could not be started, i.e. because one is
* already in progress or the Bluetooth service has not
* been started.
*
* @sa StopInquiry(), InquiryStateChanged(), InquiryResult()
*/
public StartInquiry();
/**
* @brief Stop an inquiry in progress
*
* Aborts an in-progress inquiry. If an inquiry was in
* progress when this method was invoked, and was
* successfully stopped, an InquiryStateChanged() signal
* will be generated.
*
* @sa StartInquiry(), InquiryStateChanged(), InquiryResult()
*/
public StopInquiry();
/**
* @brief Read the Bluetooth name of a given device
*
* This method executes the read name function on a
* given Bluetooth device and returns the name as a
* string.
*
* @param[in] address Address of the Bluetooth device to
* read the name of, in colon-separated form, e.g.
* "01:23:45:67:89:AB"
* @param[out] name Name of the device as read, returned
* as a string, e.g. "Motorola Phone"
*
* @throw net.sf.nohands.hfpd.Error Thrown on any
* sort of error, unspecific of the reason of failure.
*
* @note This method may take an extended period of time
* to complete, and should be executed asynchronously.
*/
public GetName(in string address, out string name);
/**
* @brief Add a device to HFPD's device list, and claim
* ownership of it.
*
* This method will create a new device record inside
* of HFPD for a device with @em address, and will mark
* it as owned by the caller's D-Bus client.
*
* Claimed devices are granted access to specific services
* provided by HFPD:
* - Claimed devices may open a service-level connection
* to HFPD at any time, even when HandsFree.AcceptUnknown
* is set to @c false. The D-Bus client that claimed the
* device will be informed of this through the
* AudioGateway.StateChanged signal emitted by the object
* created to represent the device.
* - Claimed devices may open an audio connection at any
* time. They will not be automatically attached to the
* audio pump and routed through the local sound card --
* this must be explicitly configured by the D-Bus client,
* typically using SoundIo.AudioGatewayStart().
*
* When HFPD starts, no devices are claimed. The D-Bus
* client must enumerate the list of devices it wishes to
* claim each time it connects to HFPD through D-Bus,
* using this method.
*
* Only one D-Bus client is allowed to claim each device.
* If a request is made to claim a device that has already
* been claimed by a different D-Bus client, the request
* will fail.
*
* HFPD monitors D-Bus disconnections. When a D-Bus client
* that has claimed devices is disconnected, its claimed
* devices are automatically released and reverted to the
* unclaimed state. The following set of actions will be
* taken on devices claimed by disconnected D-Bus clients:
* - If the device has an audio connection open, the audio
* connection will be closed, unless HandsFree.VoicePersist
* is set to @c true.
* - If the device is connecting or connected, and is not
* permanently known to HFPD, and does not have a persisting
* audio connection as above, it will be disconnected.
*
* @param[in] address Bluetooth address of the target device,
* in colon-separated form, e.g. "01:23:45:67:89:AB"
* @param[in] set_known Set to @c true to mark the device as
* permanently known to HFPD, so that it may connect
* to HFPD and open an audio channel when not claimed by a
* D-Bus client. This mark will be saved to HFPD's
* configuration file and will be persistent.
* @param[out] object D-Bus path to the AudioGateway
* object created to represent the device.
*
* @throw net.sf.nohands.hfpd.Error Thrown on any
* sort of error, unspecific of the reason of failure.
*
* @sa RemoveDevice()
*/
public AddDevice(in string address, in bool set_known,
out objectpath object);
/**
* @brief Release a claim on a device
*
* For devices that have been claimed by a given D-Bus
* client, this method releases the claim on the device
* and disconnects the device if it is connected.
*
* @param[in] address Bluetooth address of the device to
* have its claim released, in colon-separated form, e.g.
* "01:23:45:67:89:AB"
*
* @throw net.sf.nohands.hfpd.Error Thrown on any
* sort of error, unspecific of the reason of failure.
*
* This method will fail if it is provided the address
* of an unknown device, or a device claimed by a
* different D-Bus client.
*
* @sa AddDevice()
*/
public RemoveDevice(in string address);
/**
* @brief Save persistent properties to the HFPD
* configuration file
*
* This method will cause the HFPD configuration file,
* located at the path in HandsFree.SaveFile,
* to be rewritten and filled with the current set of
* non-default values for configuration options.
*
* It is not necessary to call this method if the
* HandsFree.AutoSave property is set to @c true.
*
* @throw net.sf.nohands.hfpd.Error Thrown if
* the configuration file could not be created or
* overwritten.
*/
public SaveSettings();
/**
* @brief Interface version provided by HFPD.
*
* This property can be accessed using the
* @ref property "standard D-Bus property interface".
*
* The D-Bus interface provided by HFPD is subject to
* changes and evolution. This property provides a fast
* way for a D-Bus client to determine whether the HFPD
* it is attempting to use implements the D-Bus interfaces
* that it expects. If a client reads this property and
* finds an unexpected value, it should fail and warn about
* a version mismatch.
*
* This document describes version 4 of the HFPD D-Bus
* interface.
*
* A version number value in this field covers all HFPD
* D-Bus interfaces, including HandsFree, SoundIo, and
* AudioGateway.
*/
const uint32 Version;
/**
* @brief Current state of Bluetooth system inside of HFPD
*
* This property can be accessed using the
* @ref property "standard D-Bus property interface".
*
* If @c true, the Bluetooth system has been started and
* is usable.
*
* If @c false, the Bluetooth system is stopped.
*
* @sa SystemStateChanged()
*/
const bool SystemState;
/**
* @brief Set of object paths for known AudioGateway objects
*
* This property can be accessed using the
* @ref property "standard D-Bus property interface".
*
* This property contains a list of the object paths of all
* AudioGateway objects known to HFPD. It can be used to
* enumerate known audio gateway devices.
*
* Changes to this property are indicated by
* AudioGatewayAdded() and AudioGatewayRemoved() signals.
*
* The D-Bus signature of this property is @c "ao".
*/
const objectpath AudioGateways[];
/**
* @brief Configuration file auto-save property
*
* This property can be accessed using the
* @ref property "standard D-Bus property interface".
*
* If @c true, changes to persistent configuration options
* will be automatically written to the local HFPD
* configuration file when they are modified.
*
* If @c false, changes to persistent configuration options
* must be explicitly written to the local HFPD configuration
* file in order to persist. This is done using
* SaveSettings(). This is default. It makes the most
* sense for frontends such as hfconsole that use
* configuration dialogs, and expect to apply new settings
* immediately but save them to the configuration file
* only when the user clicks "OK."
*
* @note AutoSave is a persistent option that is, itself,
* saved to the HFPD configuration file.
*/
bool AutoSave;
/**
* @brief Path and name of the HFPD local configuration file
*
* This property can be accessed using the
* @ref property "standard D-Bus property interface".
*
* This value identifies the configuration file that
* HFPD uses to store local settings. It defaults to
* @c "~/.hfpdrc"
*
* @sa SaveSettings()
*/
string SaveFile;
/**
* @brief Property to control periodic restart attempts
* for the Bluetooth service
*
* This property can be accessed using the
* @ref property "standard D-Bus property interface".
*
* When the Bluetooth service cannot be started, e.g.
* because there is no dongle plugged in, this property
* enables periodic attempts to start the Bluetooth
* service.
*
* If set to @c true, periodic auto-restart is enabled.
* This is the default value.
*
* If set to @c false, periodic auto-restart is disabled.
*
* @note AutoRestart will be automatically set to @c false
* when certain severe errors are encountered. These
* include:
* - Lack of sufficient kernel support for Bluetooth
* - Improper SCO MTU values or voice settings on the HCI
* @note AutoRestart is a persistent option that is
* saved to the HFPD configuration file.
*/
bool AutoRestart;
/**
* @brief Security mode for HFP service-level connections
*
* This property can be accessed using the
* @ref property "standard D-Bus property interface".
*
* This property allows the D-Bus client to control
* the security requirements placed on RFCOMM
* service-level connections for HFP. It may be set to
* one of three values:
*
* - 0 = No security requirements.
* - 1 = PIN authentication required. Most audio gateway
* devices will impose this requirement anyway.
* - 2 = PIN authentication and encryption required.
*
* Changes to this value affect new connections only,
* existing connections are not affected.
*
* The Bluetooth Hands-Free Profile specification version 1.5
* does not place any specific requirements on the
* security of RFCOMM service-level connections for HFP.
* This value defaults to 1 (PIN authentication).
*
* @note SecMode is a persistent option that is saved to
* the HFPD configuration file.
*/
byte SecMode;
/**
* @brief Property controlling whether unknown devices
* are allowed to initiate service-level connections
*
* This property can be accessed using the
* @ref property "standard D-Bus property interface".
*
* If @c true, devices not claimed by a D-Bus client and
* not marked permanently known are permitted to initiate
* service-level connections to hfpd.
*
* If @c false, incoming service-level connections from
* devices not claimed by a D-Bus client and not marked
* permanently known are refused. This is the default.
*
* In order for an unknown device to initiate pairing and
* make itself known to a D-Bus client, this value must be
* set to @c true. In this case, D-Bus clients will be
* informed of inbound connections from previously unknown
* devices by the AudioGatewayAdded() signal. Otherwise,
* all new device pairing must be initiated by D-Bus
* clients, typically using StartInquiry() and AddDevice().
*
* @note AcceptUnknown is a persistent option that is saved
* to the HFPD configuration file.
*/
bool AcceptUnknown;
/**
* @brief Property controlling whether SCO audio
* functionality will be used.
*
* This property can be accessed using the
* @ref property "standard D-Bus property interface".
*
* If @c true, SCO audio support is enabled. This allows
* voice audio data to be exchanged over Bluetooth, and
* is the default.
*
* If @c false, SCO audio will not be used. This may
* permit hfpd to operate in environments where another
* service provides support for streaming SCO audio to
* the local sound card.
*
* @note ScoEnabled is a persistent option that is
* saved to the HFPD configuration file.
*/
bool ScoEnabled;
/**
* @brief Property controlling handling of audio connections
* for unclaimed devices
*
* This property can be accessed using the
* @ref property "standard D-Bus property interface".
*
* When the D-Bus owner of a claimed device is disconnected
* from D-Bus, often because a defect in the D-Bus client
* caused it to crash, normally all of its claimed devices
* will be immediately disconnected. If one of the devices
* has its audio connection configured and routed through
* the local sound card, it may be undesirable to disconnect
* it immediately. This property controls special handling
* of devices in the aforementioned situation.
*
* If @c true, the device will remain connected until its
* audio connection is dropped, either due to the device
* itself dropping the connection, or a sound card failure.
* When the audio connection is dropped, the device will be
* disconnected immediately.
*
* If @c false, the device will be disconnected immediately.
* Audio will be rerouted through the device itself.
*
* @note VoicePersist is a persistent option that is
* saved to the HFPD configuration file.
*/
bool VoicePersist;
/**
* @brief Property controlling handling of audio connections
* from unclaimed but permanently known devices
*
* This property can be accessed using the
* @ref property "standard D-Bus property interface".
*
* When a permanently known device connects to HFPD, it
* may do so outside the supervision of a D-Bus client.
* Normally, the D-Bus client is responsible for
* noticing when a device initiates an audio connection,
* and for either routing the audio connection to the
* local sound card or immeidately dropping the audio
* connection. It may be desirable for HFPD to automatically
* try to route audio connections initiated by permanently
* known devices. This property controls special handling
* of devices in the aforementioned situation.
*
* If @c true, HFPD will attempt to automatically route
* incoming audio connections from permanently known,
* unclaimed devices to the local sound card. If routing
* fails, the audio connection to the device will be closed.
*
* If @c false, HFPD will refuse incoming audio connections
* from permanently known, unclaimed devices. For security,
* this is the default value.
*
* @note VoiceAutoConnect is a persistent option that is
* saved to the HFPD configuration file.
*/
bool VoiceAutoConnect;
/**
* @brief Hands-free capability bit field reported to
* audio gateway devices when handshaking
*
* This property can be accessed using the
* @ref property "standard D-Bus property interface".
*
* The Bluetooth Hands-Free Profile specification identifies
* a supported features bit field that is presented by the
* hands-free to the audio gateway device when initiating
* a service level connection. This property allows
* D-Bus clients access to the reported supported features.
*
* This field can be used to inform devices not to
* expect the hands-free to support specific features,
* such as voice recognition activation and volume control.
*
* Most D-Bus clients should not need to change the
* value of this property.
*/
uint32 ReportCapabilities;
/**
* @brief Service name string set in HFPD's SDP record.
*
* This property can be accessed using the
* @ref property "standard D-Bus property interface".
*
* The SDP record created by HFPD has a customizable service
* name string. It is not generally end-user visible,
* but can be queried using @c "sdptool records local".
* The default value is @c "Handsfree".
*/
string ServiceName;
/**
* @brief Service description string set in HFPD's
* SDP record.
*
* This property can be accessed using the
* @ref property "standard D-Bus property interface".
*
* The SDP record created by HFPD has a customizable service
* description string. It is not generally end-user visible,
* but can be queried using @c "sdptool records local".
* By default, the description field is empty.
*/
string ServiceDesc;
/**
* @brief Notification of Bluetooth system state change
*
* This signal is sent whenever the Bluetooth system state
* changes, e.g. when it transitions from started to
* stopped due to the unplugging of a Bluetooth dongle.
*
* @param[out] state The parameter is set to @c true if the
* Bluetooth system transitioned to the started state,
* @c false if it transitioned to the stopped state.
*
* @sa Start(), Stop().
*/
public signal SystemStateChanged(out bool state);
/**
* @brief Notification of Bluetooth inquiry state change
*
* This signal is sent whenever a Bluetooth inquiry
* is started or completed.
*
* @param[out] state The parameter is set to @c true if a
* Bluetooth inquiry has been started, @c false if a
* running Bluetooth inquiry has completed or has been
* terminated by StopInquiry().
*
* @sa StartInquiry(), StopInquiry(), InquiryResult()
*/
public signal InquiryStateChanged(out bool state);
/**
* @brief Notification of newly-discovered Bluetooth
* inquiry result
*
* This signal is sent whenever a previously started
* Bluetooth inquiry discovered a new, unique device.
*
* @param[out] address The Bluetooth address of the newly
* discovered device, formatted as a colon-separated
* string, e.g. "01:23:45:67:89:AB"
* @param[out] device_class The reported Bluetooth device
* class of the newly discovered device. This can be
* used to filter devices, e.g. to display only those
* that implement audio gateway functionality.
*
* @sa StartInquiry(), StopInquiry(), InquiryStateChanged()
*/
public signal InquiryResult(out string address,
out uint32 device_class);
/**
* @brief Notification of newly-created AudioGateway
* object
*
* When a D-Bus client claims a previously unknown device,
* and when a previously unknown device initiates an
* inbound service level connection, this signal is emitted.
*
* The new AudioGateway object is also added to
* HandsFree.AudioGateways.
*
* @param object D-Bus path to new AudioGateway object.
*/
public signal AudioGatewayAdded(out objectpath object);
/**
* @brief Notification of destroyed AudioGateway
* object
*
* When no reasons remain to retain an AudioGateway object,
* it is removed from the list of known AudioGateway
* objects and its D-Bus object is destroyed. This signal
* informs of such an event.
*
* An AudioGateway object can be removed when:
* - It is not claimed by any D-Bus client
* - It is not marked permanently known to HFPD
* - It does not have a persisting audio connection
*
* The removed AudioGateway object is also removed from
* HandsFree.AudioGateways.
*
* @param object D-Bus path to removed AudioGateway object.
*/
public signal AudioGatewayRemoved(out objectpath object);
}
/**
* @brief Interface for managing HFPD's audio data pump
*
* The SoundIo interface allows a D-Bus client to control
* settings related to the local sound card, routing of audio
* packets from AudioGateway devices, the software digital
* signal processor, and other audio-related functions provided
* by HFPD.
*
* The HFPD process will instantiate one object that implements
* this interface at path @b @c /net/sf/nohands/hfpd/soundio
*/
interface SoundIo {
/**
* @brief Set the local sound card driver and options
* used by the SoundIo
*
* @param[in] drivername Name of the sound driver to use.
* Available drivers can be enumerated by reading the
* SoundIo.Drivers property.
* @param[in] driveropts Options string for the driver.
* Options strings are specific to each driver, but
* specifying an empty options string will cause the
* driver to use intelligent defaults.
*
* @note The sound card driver settings are persistent
* options that are saved to the HFPD configuration file.
* @note On success, @c drivername will be assigned to the
* SoundIo.DriverName property, and @c driveropts to the
* SoundIo.DriverOpts property.
*/
public SetDriver(in string drivername, in string driveropts);
/**
* @brief Probe for local sound card devices available
* from a specific driver
*
* This method actively searches for available sound
* card device names, and returns the list. For most
* drivers, one of the return values of this method can
* be supplied as the @c driveropts parameter to
* SetDriver().
*
* @param[in] drivername Name of audio driver to probe.
* Available drivers can be enumerated by reading the
* SoundIo.Drivers property.
* @param[out] found_devices Array of string pairs
* describing the result of the device probe. This
* field has D-Bus signature @c "a(ss)".
* - The first subscript of each array element is
* the name of the device as specifiable to SetDriver(),
* e.g. @c "/dev/dsp"
* - The second subscript of each array element is a
* human-readable description of the device, if available,
* e.g. @c "Intel HD Audio"
*
* @throw net.sf.nohands.hfpd.Error Thrown on any
* sort of error, unspecific of the reason of failure.
*/
public ProbeDevices(in string drivername,
out string[2][] found_devices);
/**
* @brief Stop any in-progress audio streaming through
* the local sound card.
*
* This method will cause an active audio stream to be
* halted, regardless of the configured endpoint. If
* streaming is not in progress, this method succeeds
* and takes no action.
*
* If the configured endpoint is an AudioGateway, the
* audio connection to the device will be closed.
*/
public Stop();
/**
* @brief Start an audio stream with an AudioGateway
* device.
*
* This method attempts to start a full duplex audio
* stream with an AudioGateway device.
*
* If an audio connection to the device is already open,
* streaming will start immediately. If the audio
* connection is not open, and the @c initiate_connection
* parameter is @c true, an attempt will be made to
* initiate the connection, and if successful, streaming
* will be started.
*
* If the local sound card is already streaming, or
* preparing to stream with a different audio gateway
* device, the operation will be aborted similar to
* Stop().
*
* @param[in] audio_gateway Object path of audio gateway
* device on which to start streaming.
* @param[in] initiate_connection Set to @c true to
* allow an audio connection to the device to be
* initiated if needed, @c false to only use an existing
* audio connection to the device.
*
* @throw net.sf.nohands.hfpd.Error Thrown on any
* sort of error, unspecific of the reason of failure.
*
* Audio gateway devices will typically perform all
* of the audio connection initiation themselves, and
* D-Bus clients should not need to direct HFPD to initiate
* audio connections. D-Bus clients can be informed of
* remotely-initiated audio connections by the
* AudioGateway.AudioStateChanged() signal, and should
* typically invoke this method (AudioGatewayStart) on
* reception of that signal.
*/
public AudioGatewayStart(in objectpath audio_gateway,
in bool initiate_connection);
/**
* @brief Start a WAV file audio stream
*
* Opens a .WAV file and initiates unidirectional
* streaming either from the file to the primary sound
* card or from the primary sound card to the file.
*
* This mode of streaming is useful for playing a
* ring tone, or for recording a voice note.
*
* @param[in] file_path Path to WAV file to be created
* and streamed to, or existing WAV file to be played
* back.
* @param[in] write Set to @c true to cause the file to
* be streamed into and created if necessary, @c false
* to play back from the file.
*
* If the local sound card is already streaming, or
* preparing to stream with an audio gateway, the
* operation in progress will be aborted similar to
* Stop().
*
* @throw net.sf.nohands.hfpd.Error Thrown on any
* sort of error, unspecific of the reason of failure.
*
* @note A stream started using this method is bound to
* the D-Bus client that made the method call. If that
* D-Bus client is disconnected from D-Bus before the
* stream is halted, the stream will be automatically
* halted, to clean up after the D-Bus client.
*/
public FileStart(in string file_path, in bool write);
/**
* @brief Start a loopback audio stream
*
* Starts streaming the input from the local sound card
* to the output to the local sound card.
*
* This mode of streaming is useful for testing the local
* sound card configuration and to subjectively evaluate
* the latency resulting from the buffering settings.
*
* If the local sound card is already streaming, or
* preparing to stream with a different audio gateway
* device, the operation will be aborted similar to
* Stop().
*
* @throw net.sf.nohands.hfpd.Error Thrown on any
* sort of error, unspecific of the reason of failure.
*
* @note A stream started using this method is bound to
* the D-Bus client that made the method call. If that
* D-Bus client is disconnected from D-Bus before the
* stream is halted, the stream will be automatically
* halted, to clean up after the D-Bus client.
*/
public LoopbackStart();
/**
* @brief Start streaming to and/or from a memory buffer
*
* A memory buffer object can be used to store small
* durations of audio data captured from the local sound
* card, and to conveniently play it back. Specifically,
* the memory buffer is useful for testing digital
* signal processing settings by simulating a two-way
* conversation without initiating a phone call.
*
* If the local sound card is already streaming, or
* preparing to stream with a different audio gateway
* device, the operation will be aborted similar to
* Stop().
*
* @param[in] capture Set to @c true to capture audio data
* from the local sound card into the memory buffer.
* If true, an existing capture buffer will be shifted to
* the playback buffer position.
* @param[in] playback Set to @c true to play back from the
* playback buffer. If no playback buffer exists, nothing
* will be played back.
* @param[in] membuf_size Size of the memory buffer, in
* 8KHz samples. For example, to get enough space to
* record up to 10 seconds, this value should be 80000.
* @param[in] report_interval Number of samples to wait
* between sending MonitorNotify() signals while streaming.
* Set to zero to disable MonitorNotify() reporting.
* Setting this value too small may overload the D-Bus
* daemon process.
*
* @throw net.sf.nohands.hfpd.Error Thrown on any
* sort of error, unspecific of the reason of failure.
*
* @note A stream started using this method is bound to
* the D-Bus client that made the method call. If that
* D-Bus client is disconnected from D-Bus before the
* stream is halted, the stream will be automatically
* halted, to clean up after the D-Bus client.
*/
public MembufStart(in bool capture, in bool playback,
in uint32 membuf_size,
in uint32 report_interval);
/**