语言

Menu
Sites
Language
There are a way to get BT mac address using c api?

I'm searching a way to get bluetooth mac address using C api based on linux not tinze platform api.

There a such api possible to use universally in tizen?

响应

4 回复
Shaswati Saha

You may go through this link. I think, you'll get the solution here.

An

@Shaswati Saha                             

Thank you but I think the link is about changing mac address using some tools.

I'm searching a api based on linux working on both android and tizen application.

Shaswati Saha

Are you finding for something similar to the program in the following link?

 http://www.binarytides.com/c-program-to-get-mac-address-from-interface-name-on-linux/

Daeyong Lee

You can get bt Mac address and name from below api.

 

https://developer.tizen.org/ko/development/api-references/native-application?redirect=https://developer.tizen.org/dev-guide/2.3.2/org.tizen.native.wearable.apireference/group__CAPI__NETWORK__BLUETOOTH__ADAPTER__MODULE.html

 

bt_initialize();

char *local_address = NULL;
int bterr = bt_adapter_get_address(&local_address);
dlog_print(DLOG_INFO, TAG, "bt address  = %s, err = %d", local_address,bterr);
if(local_address)
free(local_address);
char *local_name = NULL;
bterr = bt_adapter_get_name(&local_name);
dlog_print(DLOG_INFO, TAG, "name: %s err = %d", local_name,bterr );
if (local_name)
free(local_name);

bt_deinitialize();

 

you will see like here

07-18 10:26:15.830 : INFO / HelloMessageProvider ( 11355 : 11355 ) : bt address  = FF:EE:AA:CC:EE:EE, err = 0
07-18 10:26:15.870 : INFO / HelloMessageProvider ( 11355 : 11355 ) : name: Gear Fit2 (EEEE) err = 0