Re: [PATCH 7/7] Add /hfp/test_hfp_gw_register_3 and /hfp/test_hfp_gw_register_4

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

 



Hi Marcin,

>>> unit/test-hfp.c | 31 +++++++++++++++++++++++++++++++
>>> 1 file changed, 31 insertions(+)
>>> 
>>> diff --git a/unit/test-hfp.c b/unit/test-hfp.c
>>> index 5e4fc11..64ecc60 100644
>>> --- a/unit/test-hfp.c
>>> +++ b/unit/test-hfp.c
>>> @@ -266,6 +266,33 @@ static const struct test_data test_register_2 = {
>>>      .prefix = prefix_brsf
>>> };
>>> 
>>> +static const char atbrsf_read[] = {'A', 'T', '+', 'B', 'R', 'S', 'F', '?',
>>> +                                                                     '\r'};
>>> +
>> 
>>        = "AT+BRSF?\r";
>> 
>>> +static const struct test_data test_register_3 = {
>>> +     .command_cb = cmd_handler,
>>> +     .server_send = atbrsf_read,
>>> +     .data_len = sizeof(atbrsf_read),
>>> +     .expected_rsp = err_rsp,
>>> +     .expected_rsp_len = sizeof(err_rsp),
>>> +     .result_cb = prefix_handler,
>>> +     .expected_cmd_type = HFP_GW_CMD_TYPE_READ,
>>> +     .prefix = prefix_brsf
>>> +};
>>> +
>>> +static const char prefix_d[] = "D";
>> 
>> I wonder why here it is acceptable and above you are making the huge effort to give every character separately.
> 
> I thought it will be more readable if raw data passed to socket will
> be declared as array, not string. Prefixes are passed as strings,
> because they are used in hfp_gw_register()  Anyway Luiz suggested to
> use common framework for this test like raw_pdu(args...) ,
> define_test(name, function, args...), (it is used in test-avctp and
> test-avrcp). Will it look better for you?

besides the ending \0, what is actually the difference? It is just wasted effort to put in strings in array from. Just call strlen() instead of sizeof() and you have what you need.

The raw_pdu approach might actually work nicely. Since what you really want is to send an AT command and get the right response back from the gateway. In that sense it is similar to what we do for SDP and AVRCP. Of course you need to have also a preamble for the whole SLC setup. And in addition you want to test the stream handling by for example sending an AT command one byte at a time.

Regards

Marcel

--
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