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

AW: [bluetooth-dev] HCI inquiry implementation



That is in general a big problem in the hci implementation. If you are
programming applications you will often need information about the return
parameter. What i have done is adding the function call

/* give the application a change to get the command results*/
  mmi_hci_return_param(buf,len);

at the end of process_return_param (u8 * buf, u32 len) in hci.c. (mmi stands
for man-machine-interface)

This function must be implemented in the application. 

void
mmi_hci_return_param (u8 * buf, u32 len)
{
}

It can simply do nothing or check for return parameter it is interested in.
Make shure not to call the stack again from this function because you are
already in the stack!

Regards
  Christian

> -----Ursprüngliche Nachricht-----
> Von:	Ulrich Mueller [SMTP:muelleru@xxxxxxx.de]
> Gesendet am:	Donnerstag, 14. Juni 2001 21:22
> An:	bluetooth-dev@xxxxxxx.com
> Betreff:	[bluetooth-dev] HCI inquiry implementation
> 
> Hi all,
> 
> I have a few suggestions regarding the HCI inquiry implementation.
> - the current implementation does not filter duplicates.
>    In hci.c, process_event(), case INQUIRY_RESULT, there is the
>    code:
> 
> for (j = 0; j < inq_res->nbr_of_units; j++) {
>     if (!memcmp(inq_res->bd_addr +
>        inq_res->nbr_of_units * 6,  tmp_bd,
>        6)) {
>           j = inq_res->nbr_of_units;
>        }
> }
> if (j >= inq_res->nbr_of_units)
>     [add new result]
> 
> I think it should be:
> 
> for (j = 0; j < inq_res->nbr_of_units; j++) {
>     if (!memcmp(inq_res->bd_addr +
>        j * 6, tmp_bd,6)) {
>           j = inq_res->nbr_of_units + 1; /* j > inq_res->nbr_of_units */
>        }
>     }
> if (j == inq_res->nbr_of_units)
>     [add new result]
> 
> - both send_inq_cmd_block() and send_cmd_block() change
>    the task state to TASK_INTERRUPTIBLE, but never restore the
>    previous state. I think that may cause some trouble.
> - I would prefer if the inquiry functions return some more information
>    beside the device address. Especially the class of device field can
>    be of a great value.
> 
> Ulrich
> 
> -
> To unsubscribe from this list: send the line "unsubscribe bluetooth-dev"
> in
> the body of a message to majordomo@xxxxxxx.com
-
To unsubscribe from this list: send the line "unsubscribe bluetooth-dev" in
the body of a message to majordomo@xxxxxxx.com