Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 7 additions & 24 deletions libraries/CurieBLE/src/internal/BLEProfileManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -241,8 +241,6 @@ int BLEProfileManager::serviceCount(const BLEDevice &bledevice) const

int BLEProfileManager::registerProfile(BLEDevice &bledevice)
{
int ret = 0;

bt_gatt_attr_t *start;
BleStatus err_code = BLE_STATUS_SUCCESS;

Expand Down Expand Up @@ -288,35 +286,20 @@ int BLEProfileManager::registerProfile(BLEDevice &bledevice)
{
BLEServiceImp *service = node->value;
start = _attr_base + _attr_index;
service->updateProfile(start, _attr_index);
node = node->next;
}

#if 0
// Start debug
int i;

for (i = 0; i < _attr_index; i++) {
err_code = service->updateProfile(start, _attr_index);
if (BLE_STATUS_SUCCESS != err_code)
{
pr_info(LOG_MODULE_APP, "gatt-: i %d, type %d, u16 0x%x",
i,
_attr_base[i].uuid->type,
BT_UUID_16(_attr_base[i].uuid)->val);
break;
}
node = node->next;
}

delay(1000);
// End for debug
#endif

ret = bt_gatt_register(_attr_base,
_attr_index);
pr_debug(LOG_MODULE_APP, "%s: ret, %d,_attr_index-%d", __FUNCTION__, ret, _attr_index);
if (0 == ret)
// Will not regiter the profile if ARC registered any profile
if (_attr_index > 0)
{
_profile_registered = true;
}
return ret;
return err_code;
}

void BLEProfileManager::clearProfile(BLEServiceLinkNodeHeader* serviceHeader)
Expand Down
2 changes: 1 addition & 1 deletion libraries/CurieBLE/src/internal/BLEProfileManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class BLEProfileManager{
*
* @param[in] bledevice The BLE Device
*
* @return int std C errno
* @return int BLE errno @BleStatus
*
* @note none
*/
Expand Down
6 changes: 5 additions & 1 deletion libraries/CurieBLE/src/internal/BLEServiceImp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ int BLEServiceImp::updateProfile(bt_gatt_attr_t *attr_start, int& index)
int base_index = index;
int offset = 0;
int counter = 0;
int ret = 0;
start->uuid = BLEServiceImp::getPrimayUuid();
start->perm = BT_GATT_PERM_READ;
start->read = bt_gatt_attr_read_service;
Expand All @@ -139,7 +140,10 @@ int BLEServiceImp::updateProfile(bt_gatt_attr_t *attr_start, int& index)
counter += offset;
node = node->next;
}
return counter;
ret = bt_gatt_register(attr_start,
counter);

return errorno_to_ble_status(ret);
}

int BLEServiceImp::getAttributeCount()
Expand Down