Commit Graph

8740 Commits

Author SHA1 Message Date
Lucas De Marchi
ab7e71ed87 avrcp: change TG record to use version 1.3 2011-08-12 11:05:11 +03:00
Lucas De Marchi
1a3de7bae4 avrcp: send response for registered events
When a certain event occur, check if CT registered to receive that
notification and send a response.

Example event for PTS test TC_TG_NFY_BV_02_C:

> ACL data: handle 11 flags 0x02 dlen 22
    L2CAP(d): cid 0x0043 len 18 [psm 23]
      AVCTP: Command : pt 0x00 transaction 2 pid 0x110e
        AV/C: Notify: address 0x48 opcode 0x00
          Subunit: Panel
          Opcode: Vendor Dependent
          Company ID: 0x001958
          AVRCP: RegisterNotification: pt 0x00 len 0x0005
            EventID: 0x02 (EVENT_TRACK_CHANGED)
            Interval: 0x00000000 (0 seconds)
< ACL data: handle 11 flags 0x02 dlen 26
    L2CAP(d): cid 0x0043 len 22 [psm 23]
      AVCTP: Response : pt 0x00 transaction 2 pid 0x110e
        AV/C: Interim: address 0x48 opcode 0x00
          Subunit: Panel
          Opcode: Vendor Dependent
          Company ID: 0x001958
          AVRCP: RegisterNotification: pt 0x00 len 0x0009
            EventID: 0x02 (EVENT_TRACK_CHANGED)
            Identifier: 0x0 (PLAYING)

[...]

< ACL data: handle 11 flags 0x02 dlen 26
    L2CAP(d): cid 0x0043 len 22 [psm 23]
      AVCTP: Response : pt 0x00 transaction 2 pid 0x110e
        AV/C: Changed: address 0x48 opcode 0x00
          Subunit: Panel
          Opcode: Vendor Dependent
          Company ID: 0x001958
          AVRCP: RegisterNotification: pt 0x00 len 0x0009
            EventID: 0x02 (EVENT_TRACK_CHANGED)
            Identifier: 0x0 (PLAYING)
2011-08-12 11:05:10 +03:00
Lucas De Marchi
a5924f6600 avrcp: handle GetElementAttributes pdu
Example responses for PTS test TC_TG_MDI_BV_04_C:

> ACL data: handle 11 flags 0x02 dlen 26
    L2CAP(d): cid 0x0042 len 22 [psm 23]
      AVCTP: Command : pt 0x00 transaction 2 pid 0x110e
        AV/C: Status: address 0x48 opcode 0x00
          Subunit: Panel
          Opcode: Vendor Dependent
          Company ID: 0x001958
          AVRCP: GetElementAttributes: pt 0x00 len 0x0009
            Identifier: 0x0 (PLAYING)
            AttributeCount: 0x00
< ACL data: handle 11 flags 0x02 dlen 70
    L2CAP(d): cid 0x0042 len 66 [psm 23]
      AVCTP: Response : pt 0x00 transaction 2 pid 0x110e
        AV/C: Stable: address 0x48 opcode 0x00
          Subunit: Panel
          Opcode: Vendor Dependent
          Company ID: 0x001958
          AVRCP: GetElementAttributes: pt 0x00 len 0x0035
            AttributeCount: 0x03
            Attribute: 0x00000001 (Title)
            CharsetID: 0x006a (UTF-8)
            AttributeValueLength: 0x0012
            AttributeValue: Walking on the Sun
            Attribute: 0x00000002 (Artist)
            CharsetID: 0x006a (UTF-8)
            AttributeValueLength: 0x0005
            AttributeValue: Lucas
            Attribute: 0x00000007 (Progress)
            CharsetID: 0x006a (UTF-8)
            AttributeValueLength: 0x0005
            AttributeValue: 32029

And TC_TG_MDI_BV_05_C:

> ACL data: handle 11 flags 0x02 dlen 30
    L2CAP(d): cid 0x0043 len 26 [psm 23]
      AVCTP: Command : pt 0x00 transaction 2 pid 0x110e
        AV/C: Status: address 0x48 opcode 0x00
          Subunit: Panel
          Opcode: Vendor Dependent
          Company ID: 0x001958
          AVRCP: GetElementAttributes: pt 0x00 len 0x000d
            Identifier: 0x0 (PLAYING)
            AttributeCount: 0x01
            Attribute: 0x00000001 (Title)
< ACL data: handle 11 flags 0x02 dlen 44
    L2CAP(d): cid 0x0043 len 40 [psm 23]
      AVCTP: Response : pt 0x00 transaction 2 pid 0x110e
        AV/C: Stable: address 0x48 opcode 0x00
          Subunit: Panel
          Opcode: Vendor Dependent
          Company ID: 0x001958
          AVRCP: GetElementAttributes: pt 0x00 len 0x001b
            AttributeCount: 0x01
            Attribute: 0x00000001 (Title)
            CharsetID: 0x006a (UTF-8)
            AttributeValueLength: 0x0012
            AttributeValue: Walking on the Sun
2011-08-12 11:05:08 +03:00
Lucas De Marchi
e468f8f1e9 avrcp: handle query for supported events 2011-08-12 11:04:52 +03:00
Lucas De Marchi
6ae019ed13 avrcp: handle RegisterNotification pdu
Handle mandatory events according to AVRCP 1.3 spec.
2011-08-12 11:04:50 +03:00
Lucas De Marchi
177d7aea76 avrcp: handle GetPlayStatus pdu
Example response for PTS test TC_TG_MDI_BV_02_C:

> ACL data: handle 11 flags 0x02 dlen 17
    L2CAP(d): cid 0x0043 len 13 [psm 23]
      AVCTP: Command : pt 0x00 transaction 2 pid 0x110e
        AV/C: Status: address 0x48 opcode 0x00
          Subunit: Panel
          Opcode: Vendor Dependent
          Company ID: 0x001958
          AVRCP: GetPlayStatus: pt 0x00 len 0x0000
< ACL data: handle 11 flags 0x02 dlen 26
    L2CAP(d): cid 0x0043 len 22 [psm 23]
      AVCTP: Response : pt 0x00 transaction 2 pid 0x110e
        AV/C: Stable: address 0x48 opcode 0x00
          Subunit: Panel
          Opcode: Vendor Dependent
          Company ID: 0x001958
          AVRCP: GetPlayStatus: pt 0x00 len 0x0009
            SongLength: 0x0000a7f8 (43000 miliseconds)
            SongPosition: 0x00012fad (77741 miliconds)
            PlayStatus: 0x01 (PLAYING)
2011-08-12 11:04:49 +03:00
Lucas De Marchi
ea42bc7391 avrcp: handle InformBatteryStatusOfCT pdu 2011-08-12 11:04:47 +03:00
Lucas De Marchi
bb8e4d6a12 avrcp: handle InformDisplayableCharacterSet pdu 2011-08-12 11:04:45 +03:00
Lucas De Marchi
3e5bde2244 avrcp: handle commands for future extension
AVRCP_GET_PLAYER_ATTRIBUTE_TEXT and AVRCP_GET_PLAYER_VALUE_TEXT shall
only be used if TG has extended attributes.

For the ones defined in AVRCP spec these commands should not be called.
Since we do not have extended attributes yet we can ignore those
commands.
2011-08-12 11:04:43 +03:00
Lucas De Marchi
81b99b59ad avrcp: handle SetPlayerApplicationSettingValue pdu 2011-08-12 11:04:42 +03:00
Lucas De Marchi
908d91867b avrcp: handle GetCurrentPlayerAplicationSettingValue pdu
Example response for PTS test TC_TG_PAS_BV_10_C:

> ACL data: handle 11 flags 0x02 dlen 19
    L2CAP(d): cid 0x0043 len 15 [psm 23]
      AVCTP: Command : pt 0x00 transaction 3 pid 0x110e
        AV/C: Status: address 0x48 opcode 0x00
          Subunit: Panel
          Opcode: Vendor Dependent
          Company ID: 0x001958
          AVRCP: GetCurrentPlayerApplicationSettingValue: pt 0x00 len 0x0002
            AttributeCount: 0x01
            AttributeID: 0x01 (Equalizer ON/OFF Status)
< ACL data: handle 11 flags 0x02 dlen 20
    L2CAP(d): cid 0x0043 len 16 [psm 23]
      AVCTP: Response : pt 0x00 transaction 3 pid 0x110e
        AV/C: Stable: address 0x48 opcode 0x00
          Subunit: Panel
          Opcode: Vendor Dependent
          Company ID: 0x001958
          AVRCP: GetCurrentPlayerApplicationSettingValue: pt 0x00 len 0x0003
            ValueCount: 0x01
            AttributeID: 0x01 (Equalizer ON/OFF Status)
            ValueID: 0x02 (ON)
2011-08-12 11:04:40 +03:00
Lucas De Marchi
0834a161e6 avrcp: handle ListPlayerApplicationSettingValues pdu
Example of response obtained with PTS test TC_TG_PAS_BV_06_C:

> ACL data: handle 11 flags 0x02 dlen 18
    L2CAP(d): cid 0x0043 len 14 [psm 23]
      AVCTP: Command : pt 0x00 transaction 3 pid 0x110e
        AV/C: Status: address 0x48 opcode 0x00
          Subunit: Panel
          Opcode: Vendor Dependent
          Company ID: 0x001958
          AVRCP: ListPlayerApplicationSettingValues: pt 0x00 len 0x0001
            AttributeID: 0x01 (Equalizer ON/OFF Status)
< ACL data: handle 11 flags 0x02 dlen 20
    L2CAP(d): cid 0x0043 len 16 [psm 23]
      AVCTP: Response : pt 0x00 transaction 3 pid 0x110e
        AV/C: Stable: address 0x48 opcode 0x00
          Subunit: Panel
          Opcode: Vendor Dependent
          Company ID: 0x001958
          AVRCP: ListPlayerApplicationSettingValues: pt 0x00 len 0x0003
            ValueCount: 0x02
            ValueID: 0x01 (OFF)
            ValueID: 0x02 (ON)
2011-08-12 11:04:38 +03:00
Lucas De Marchi
0c6cadf915 avrcp: handle ListPlayerApplicationSettingAttributes pdu
Example of response obtained with PTS test TC_TG_PAS_BV_06_C:

> ACL data: handle 11 flags 0x02 dlen 17
    L2CAP(d): cid 0x0043 len 13 [psm 23]
      AVCTP: Command : pt 0x00 transaction 2 pid 0x110e
        AV/C: Status: address 0x48 opcode 0x00
          Subunit: Panel
          Opcode: Vendor Dependent
          Company ID: 0x001958
          AVRCP: ListPlayerApplicationSettingAttributes: pt 0x00 len 0x0000
< ACL data: handle 11 flags 0x02 dlen 20
    L2CAP(d): cid 0x0043 len 16 [psm 23]
      AVCTP: Response : pt 0x00 transaction 2 pid 0x110e
        AV/C: Stable: address 0x48 opcode 0x00
          Subunit: Panel
          Opcode: Vendor Dependent
          Company ID: 0x001958
          AVRCP: ListPlayerApplicationSettingAttributes: pt 0x00 len 0x0003
            AttributeCount: 0x02
            AttributeID: 0x01 (Equalizer ON/OFF Status)
            AttributeID: 0x04 (Scan ON/OFF Status)
2011-08-12 11:04:37 +03:00
Lucas De Marchi
f25568f3b6 avrcp: handle query for company ids
Example of response for PTS test TC_TG_CFG_BV_02_C:

> ACL data: handle 11 flags 0x02 dlen 18
    L2CAP(d): cid 0x0043 len 14 [psm 23]
      AVCTP: Command : pt 0x00 transaction 2 pid 0x110e
        AV/C: Status: address 0x48 opcode 0x00
          Subunit: Panel
          Opcode: Vendor Dependent
          Company ID: 0x001958
          AVRCP: GetCapabilities: pt 0x00 len 0x0001
            CapabilityID: 0x02 (CompanyID)
< ACL data: handle 11 flags 0x02 dlen 22
    L2CAP(d): cid 0x0043 len 18 [psm 23]
      AVCTP: Response : pt 0x00 transaction 2 pid 0x110e
        AV/C: Stable: address 0x48 opcode 0x00
          Subunit: Panel
          Opcode: Vendor Dependent
          Company ID: 0x001958
          AVRCP: GetCapabilities: pt 0x00 len 0x0005
            CapabilityID: 0x02 (CompanyID)
            CapabilityCount: 0x01
            CompanyID: 0x001958
2011-08-12 11:04:35 +03:00
Lucas De Marchi
65e27905fe avrcp: implement ChangeTrack() method
ChangeTrack() is used by applications to inform bluetoothd that current
track changed, passing also the metadata.
2011-08-12 11:04:33 +03:00
Lucas De Marchi
85206cbbde avrcp: implement ChangePlayback() method
ChangePlayback() is used by applications to inform bluetoothd of the
current status of playback.
2011-08-12 11:04:32 +03:00
Lucas De Marchi
b7dd3c8a8a avrcp: implement SetProperty() method of MediaPlayer
SetProperty() is used by an application to set player specific
settings.
2011-08-12 11:04:30 +03:00
Lucas De Marchi
8c8eaec49b avrcp: add skeleton of MediaPlayer interface 2011-08-12 11:04:29 +03:00
Lucas De Marchi
be70215da3 audio: move interface declarations to their headers 2011-08-12 11:04:27 +03:00
Syam Sidhardhan
6e863c7e83 Fix crash when disconnecting A2DP
When we disconnect an A2DP device by immediate power off and quickly
also initiate a disconnection from our side, a crash is occurring. This
is happening because of the disconnect_timeout coming after freeing the
session.
2011-08-12 10:57:36 +03:00
Claudio Takahasi
cf71a33981 Fix wrong alert value for ImmediateAlertLevel
GetProperties method is returning wrong value for ImmediateAlertLevel.
Bug introduced by ffd21d4027
2011-08-09 10:23:25 +03:00
Claudio Takahasi
8aeefd684c Write Immediate Alert if connected
When SetProperty for ImmediateAlertLevel is called, write operation to
update the characteristic in the Immediate Alert Service can be sent
if the connection is established.
2011-08-09 10:23:23 +03:00
Claudio Takahasi
9925efa4fe Set default value for ImmediateAlertLevel
Alert Level of the Immediate Alert service is write only. "none" can be
the default value since the alert/alarm is disabled at disconnection.
2011-08-09 10:23:21 +03:00
Claudio Takahasi
117ae0ffbd Reset the Immediate Alert at disconnection
Reporter will turn off the alert when the link is disconnected. At the
Proximity Monitor side, the Immediate Alert level should also follow
the same logic.
2011-08-09 10:23:19 +03:00
Claudio Takahasi
9f2c31aacf Reset Immediate Alert after 5 seconds
Add implementation specific timeout. Immediate Alert is set to "none"
after the timeout. Reporter can also implement a timeout for reseting
the alert level. Alert level is a write only and not notifiable
characteristic. In the timeout source, the Proximity Monitor writes
"none" in the Reporter and notifies the D-Bus clients that the alert
level has changed.
2011-08-09 10:23:17 +03:00
Claudio Takahasi
f43d9216d0 Request connection when writting Immediate alert
When Link and Path Loss are disabled, ATT connection callback will
be registered. Client using FindMe Profile needs to request ATT
connection before writting the Immediate Alert characteristic value.
2011-08-09 10:23:15 +03:00
Claudio Takahasi
b5a72304ac Write Immediate Alert after discovering handle
Write the Immediate Alert level characteristic if there is a pending
alert value to be written after discovering the characteristic handle.
2011-08-09 10:23:13 +03:00
Claudio Takahasi
3aa6ac9726 Emit PropertyChanged after writting alert
Wait sending write characteristic value for Immediate Alert before
sending a PropertyChanged signal in the Proximity Monitor. Applied
to FindMe Profile and Path Loss service when the threshold is reached.
2011-08-09 10:23:12 +03:00
Claudio Takahasi
9f0ecf1940 Write Immediate Alert if necessary
Immediate Alert value needs to be written when the connection is
established.
2011-08-09 10:23:10 +03:00
Claudio Takahasi
0dfc8a9a41 Add Immediate Alert handle discovery 2011-08-09 10:23:08 +03:00
Bruna Moreira
dc8ebb30a3 Add read remote Tx Power
Read the remote Tx Power when the connection is established.
2011-08-09 10:23:06 +03:00
Luiz Augusto von Dentz
bd3ca4fdf4 Fix possible invalid read/free on media.c
This also fix the circular dependency of media.c and a2dp.c

 Invalid read of size 8
    at 0x4EA8CC2: g_slice_free_chain_with_offset (in /lib64/libglib-2.0.so.0.2908.0)
    by 0x13AF33: path_free (media.c:417)
    by 0x11EB39: remove_interface (object.c:563)
    by 0x11F360: g_dbus_unregister_interface (object.c:715)
    by 0x120C49: media_server_remove (manager.c:1098)
    by 0x4EA9826: g_slist_foreach (in /lib64/libglib-2.0.so.0.2908.0)
    by 0x178915: adapter_remove (adapter.c:2326)
    by 0x17535F: btd_manager_unregister_adapter (manager.c:293)
    by 0x154081: device_event (hciops.c:2643)
    by 0x1543C1: io_stack_event (hciops.c:2763)
    by 0x4E8C88C: g_main_context_dispatch (in /lib64/libglib-2.0.so.0.2908.0)
    by 0x4E8D087: ??? (in /lib64/libglib-2.0.so.0.2908.0)
  Address 0x63f6638 is 8 bytes inside a block of size 16 free'd
    at 0x4A055FE: free (vg_replace_malloc.c:366)
    by 0x4E938F2: g_free (in /lib64/libglib-2.0.so.0.2908.0)
    by 0x4EA854E: g_slice_free1 (in /lib64/libglib-2.0.so.0.2908.0)
    by 0x4EA930C: g_slist_remove (in /lib64/libglib-2.0.so.0.2908.0)
    by 0x13AE53: media_endpoint_remove (media.c:118)
    by 0x4EA9826: g_slist_foreach (in /lib64/libglib-2.0.so.0.2908.0)
    by 0x4EA984A: g_slist_free_full (in /lib64/libglib-2.0.so.0.2908.0)
    by 0x13AF33: path_free (media.c:417)
    by 0x11EB39: remove_interface (object.c:563)
    by 0x11F360: g_dbus_unregister_interface (object.c:715)
    by 0x120C49: media_server_remove (manager.c:1098)
    by 0x4EA9826: g_slist_foreach (in /lib64/libglib-2.0.so.0.2908.0)
2011-08-08 16:47:02 +03:00
Johan Hedberg
62e53bd9c8 Remove redundant semicolon 2011-08-08 13:35:44 +03:00
Claudio Takahasi
bf12408007 Skip Link Loss handle discovery
Skip characteristic value handle discovery for Link Loss service if the
handle is already known.
2011-08-08 13:26:46 +03:00
Claudio Takahasi
37267653ed Add function to check invalid alert level value 2011-08-08 13:24:15 +03:00
Bruna Moreira
44bc8f5572 Add enum for alert level values 2011-08-08 13:24:12 +03:00
Claudio Takahasi
eb0d86a71f Add utility function to convert alert levels
Convert Link Loss or Immediate Alert Level string to byte.
2011-08-08 13:24:11 +03:00
Claudio Takahasi
daf610e464 Write Link Loss alert if the service is enabled
Verifies if the Link Loss service is enabled before writting the Link
Loss Alert Level in the Proximity Reporter.
2011-08-08 13:24:09 +03:00
Claudio Takahasi
17dfaf0eb0 Request connection if Link or Path Loss is enabled
Proximity Monitor needs to keep the link up if Link Loss and/or Path
Loss service is enabled.
2011-08-08 13:24:08 +03:00
Claudio Takahasi
bd084a4cfd Parse handles when probing on Proximity
Primary services start and end handles can now be obtained during
probing. This approach avoids primary service parsing on each
connection in the Proximity Monitor.
2011-08-08 13:24:04 +03:00
Claudio Takahasi
b2873faecd Fix error when proximity config file is missing
Adds checking to avoid the following GLib critical error:
Parsing /etc/bluetooth/proximity.conf failed: No such file or directory
GLib-CRITICAL **: g_key_file_get_string_list: assertion `key_file !=
NULL' failed
2011-08-08 13:22:35 +03:00
Claudio Takahasi
d7ea6429e1 Fix memory allocation in Proximity Monitor
textfile get functions returns memory allocated using malloc. String
is now being re-allocated using glib functions to keep the code standard
in the Proximity Monitor code.
2011-08-08 13:22:32 +03:00
Claudio Takahasi
b5494d7a8d Add get Path Loss RSSI signal level
Extends GetProperties method of the Proximity Monitor adding SignalLevel
Property. Possible values: "unknown", "good", "regular", "weak".
"unknown" will be returned if the link is disconnected.
2011-08-08 13:16:40 +03:00
Claudio Takahasi
ffd21d4027 Add get Immediate Alert for Proximity Monitor
Extends GetProperties method of the Proximity Monitor adding
ImmediateAlertLevel property when Path Loss and/or Find Me is enabled
2011-08-08 13:16:39 +03:00
Claudio Takahasi
1cbbcf3500 Add set Immediate Alert for Proximity Monitor
Extends SetProperty of the Proximity Monitor adding ImmediateAlertLevel
property. The value will be written in the Alert level of the remote's
Immediate Alert Level service. Property shared between FindMe and Path
Loss.
2011-08-08 13:16:27 +03:00
Anderson Lizardo
3c19214717 Remove bogus extra semicolons 2011-08-08 13:04:34 +03:00
Dmitriy Paliy
fad552de92 Fix cancel pending D-Bus call to ohmd
Pending D-Bus call to ohmd daemon is canceled if telephony driver is
unloaded before reply comes.
2011-08-05 12:40:29 +03:00
Johan Hedberg
fb25161654 Move around static functions to avoid forward-declarations 2011-08-05 12:40:06 +03:00
Dmitriy Paliy
ccd40753e9 Add stop playing ringtone to maemo6 telephony driver
If ringtone is loud enough, it may leak to microphone when call is
answered via Bluetooth headset. As result, it can be heard on remote
end. Therefore, playing ringtone shall be stopped as fast as possible
before answering a call.
2011-08-05 12:39:42 +03:00
Frédéric Dalleau
bc66f33f63 Minor style fix in audio/gateway.c 2011-08-05 12:19:35 +03:00