char *mac = NULL;
- bt_initialize();
+ int ret = bt_initialize();
+ if (ret != BT_ERROR_NONE) {
+ _ERR("bt_initialize() failed.");
+ return std::string();
+ }
+
bt_adapter_state_e btState;
- bt_adapter_get_state(&btState);
+ ret = bt_adapter_get_state(&btState);
+ if (ret != BT_ERROR_NONE) {
+ _ERR("Failed to get bt_adapter state");
+ return std::string();
+ }
+
if (btState == BT_ADAPTER_ENABLED) {
- bt_adapter_get_address(&mac);
+ ret = bt_adapter_get_address(&mac);
+ if (ret != BT_ERROR_NONE) {
+ _ERR("bt_adapter_get_address() failed");
+ return std::string();
+ }
if (mac != NULL) {
char *macClone = _SAFE_DUP(mac);
_INFO("%s", macClone);