Re: [PATCH BlueZ] android/avrcp-lib: Change API to register callbacks instead of PDU handlers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Andrei,

On Wed, Mar 12, 2014 at 4:02 PM, Andrei Emeltchenko
<andrei.emeltchenko.news@xxxxxxxxx> wrote:
> Hi Luiz,
>
> On Wed, Mar 12, 2014 at 03:19:02PM +0200, Luiz Augusto von Dentz wrote:
>> From: Luiz Augusto von Dentz <luiz.von.dentz@xxxxxxxxx>
>>
>> This adds avrcp_register_player function to register callbacks for
>> requests and responses, the fundamental difference is that the
>> callbacks are called after the original PDU is parsed and the parameter
>> are converted to host byte order making us able to unit test the
>> parsing itself.
>> ---
>>  android/avrcp-lib.c | 23 +++++++++++++++++
>>  android/avrcp-lib.h | 73 +++++++++++++++++++++++++++++++++++++++++++++++++++++
>>  2 files changed, 96 insertions(+)
>>
>> diff --git a/android/avrcp-lib.c b/android/avrcp-lib.c
>> index befc404..953674b 100644
>> --- a/android/avrcp-lib.c
>> +++ b/android/avrcp-lib.c
>> @@ -73,6 +73,7 @@ struct avrcp_header {
>>
>>  struct avrcp {
>>       struct avctp *conn;
>> +     struct avrcp_player *player;
>>
>>       size_t tx_mtu;
>>       uint8_t *tx_buf;
>> @@ -89,6 +90,13 @@ struct avrcp {
>>       void *destroy_data;
>>  };
>>
>> +struct avrcp_player {
>> +     const struct avrcp_control_ind *ind;
>> +     const struct avrcp_control_cfm *cfm;
>> +
>> +     void *user_data;
>> +};
>> +
>>  void avrcp_shutdown(struct avrcp *session)
>>  {
>>       if (session->conn) {
>> @@ -249,6 +257,21 @@ void avrcp_set_destroy_cb(struct avrcp *session, avrcp_destroy_cb_t cb,
>>       session->destroy_data = user_data;
>>  }
>>
>> +void avrcp_register_player(struct avrcp *session,
>> +                             const struct avrcp_control_ind *ind,
>> +                             const struct avrcp_control_cfm *cfm,
>> +                             void *user_data)
>> +{
>> +     struct avrcp_player *player;
>> +
>> +     player = g_new0(struct avrcp_player, 1);
>
> where do you free it?

Most likely with the session, this is not the complete implementation
just an idea.
--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux