Reply
Posts: 17
Registered: ‎03-16-2017

reset the connection of BGM121

Hi,

 

I want to allow only particular BT-MAC addresses to be connectable to the BGM121. There is a possiblity to get an address of a connected device (bd_addr activeAddress = evt->data.evt_le_connection_opened.addressRobot wink

 

I have two questions:

The returned address is not the MAC address, but its an unique value which identifies a phone clearly. Has the returned value somehow to be encoded to get the real MAC?

How can I use this "MAC" to refuse connections of unwanted phones? I could not find any function of kind gecko_cmd ... close_connection

Posts: 2,052
Registered: ‎09-01-2015

Re: reset the connection of BGM121

I don't see how the title of the post (reset the connection of BGM121) has anything to do with the actual question that you asked?

 

Phones use random Bluetooth address that changes frequently. It is not possible to do access control based on this random address. There is no API call to get the "real MAC".

 

Is there some reason why you don't use bonding (either Just Works or MITM)? A BGScript based bonding example is available here:

http://community.silabs.com/t5/Bluetooth-Wi-Fi-Knowledge-Base/BGScript-Bonding-example-for-BGM111/ta...

 

 

 

Posts: 17
Registered: ‎03-16-2017

Re: reset the connection of BGM121

I thought that I explained it well, but it doesn't seem so.

 

I want the MAC of a phone for the decision, if that particular phone is allowed to connect to the phone or not. if not, I want to "reset the connection" or in other words, refuse the connection to the phone.

 

Bonding is just one of all possibilities to get the behavior I want. But bonding lacks also of some "features": neither the function gecko_cmd_sm_set_bondable_mode(0) nor the function gecko_cmd_sm_store_bonding_configuration(1,0) behaves as expected (and explained in the API), so I tried another way to allow just one phone to connect (and bond).

 

Posts: 2,052
Registered: ‎09-01-2015

Re: reset the connection of BGM121

OK now I see what you mean by the "reset connection" in the title.

 

In any case, using the phone's random Bluetooth address is not a working solution because the address changes frequently. 

 

Posts: 17
Registered: ‎03-16-2017

Re: reset the connection of BGM121

Where do you got this information? The MAC is the hardcoded address of the chip, what sense should it have to change the MAC permanently?

 

btw, my mobile doesn't change it's bluetooth MAC... It's the same every day and also after a reboot.

Posts: 2,052
Registered: ‎09-01-2015

Re: reset the connection of BGM121

This is perhaps not the most reliable source of information, but the explanation seems quite good to me:

http://stackoverflow.com/questions/28602672/android-5-static-bluetooth-mac-address-for-ble-advertisi...

 

Your phone does have a static Bluetooth address that is probably hard-coded into the Bluetooth chipset. But have you tested what is the Bluetooth event displayed on the BGM121 when you connect with your phone? At least in all the tests I have done with Android or iPhone the random address is used when connecting to a peripheral.

 

Here's another reference, this is from Bluetooth SIG website:

https://blog.bluetooth.com/bluetooth-technology-protecting-your-privacy

 

Highlighted
Posts: 2,052
Registered: ‎09-01-2015

Re: reset the connection of BGM121

If you want to drop a connection, for whatever reason (e.g. based on the Bluetooth address) then the correct API call for this is gecko_cmd_endpoint_close. The connection handle is passed as parameter. This is probably what you were originally looking for, right? 

 

 

Posts: 17
Registered: ‎03-16-2017

Re: reset the connection of BGM121

Ah, yes, I will give it a try.. I have overlooked it in the docs..