This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Reading device name on Mindtree Bluetooth stack for MSP430F5190

Hi everyone,

I'm a bit puzzled about a few of the "read" API calls.  For example, the documentation claims:

---------------------------

Name

BT_hci_read_local_name(): To read the name of the local Bluetooth device

Synopsis

 

#include “BT_hci_api.h”

 

API_RESULT BT_hci_read_local_name

(

void

);

 

Description

This API reads the name set in the local Bluetooth device.

IN Parameters

None.

OUT Parameters

None.

Function Return

API_RESULT: API_SUCCESS or one of the error codes as defined in BT_error.h or Host Controller Error Codes section.

Notes

None.

---------------------------

Note that the return value is not a string (char *) but instead is an API_RESULT, which appears to be a UINT16.  I'm not sure what the point of this API call is, as returning an error code tells the user whether or not the name could be read but not what the name actually is.

As best I can tell, a basic local name is passed to the bluetooth_on function.  Internally, this name appears to be appended with the last 4 digits of the BT address (BlueMSP430ABCD, for example).  It seems that given this behavior there should be a way to read out the local device's bluetooth name without having to build it myself.

 

I basically have 2 questions:

1. What is the proper method of reading the bluetooth's local device name (the name we specify with SDK_CONFIG_NAME and the appended MAC address, all in the same string)?

2. What is the intended purpose of this read API call?  If you search the part I documentation for "BT_hci_read", you'll find that there are several functions which have void arguments and return API_RESULT, which seems to be more of a "can I read this parameter" as opposed to an actual read of a given parameter.  I get the feeling I'm misunderstanding the usage model.  Could you please clarify?

 

Thanks

 

-Freddy

  • Hi Freddy,

            Please find my answers below. Let me know if it helps.

    1. What is the proper method of reading the bluetooth's local device name (the name we specify with SDK_CONFIG_NAME and the appended MAC address, all in the same string)?

     [MS]: The BT_hci_read_local_name() API should be used. The direct return from this API indicates if the API is executed correctly only. The return value (the local name) comes back in the sdk_hci_event_indication_callback function located in the appl_cb.c file. Specifically, the check “HCI_READ_LOCAL_NAME_OPCODE == value_2” should be inserted under the “case HCI_COMMAND_COMPLETE_EVENT:” to read the local name.

    2. What is the intended purpose of this read API call?  If you search the part I documentation for "BT_hci_read", you'll find that there are several functions which have void arguments and return API_RESULT, which seems to be more of a "can I read this parameter" as opposed to an actual read of a given parameter.  I get the feeling I'm misunderstanding the usage model.  Could you please clarify?

    [MS]: As explained above, the direct return from these APIs indicate if the API is executed correctly only. The return values come back in the sdk_hci_event_indication_callback. It depends on the command the event that is generated. Hence, the corresponding OPCODE check should be placed in the proper EVENT case. Please refer to the appl_cb.c file for examples.

     

     

  • The EtherMind HCI API "BT_hci_read_local_name()" is the implementation of HCI command 'Read Local Name'.

    When the application calls BT_hci_read_local_name(), the HCI command "Read Local Name" is sent to the controller and as per the the
    Bluetooth HCI specification, the corresponding Command Complete event will contain the "Local Name".

    Regards,
    Nir