Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to create GATT service entry in local database #5

Open
danimasa opened this issue Feb 16, 2022 · 1 comment
Open

Failed to create GATT service entry in local database #5

danimasa opened this issue Feb 16, 2022 · 1 comment

Comments

@danimasa
Copy link

Hello

I'm trying to run the example in a raspberry pi but I'm getting an error registering the application via d-bus. Below is what is getting printed in my syslog:

bluetoothd[487]: Failed to read "Includes" property of service
bluetoothd[487]: Failed to add service
bluetoothd[487]: Failed to create GATT service entry in local database

Is it a problem with some configuration of my setup?

@blueberryzosa
Copy link

Hello,

The same thing happened to me. I did some investigation and found a fix. The property "Includes" of GattService1 should point to the paths of the service's characteristics. Right now it only points to the paths of subservices. In the file GattService1.cpp I changed the addCharacteristic and removeCharacteristic function to this:

void GattService1::addCharacteristic( std::shared_ptr characteristic )
{
const std::string& charPath = characteristic->getPath();

for( auto chrc : characteristics_ )
{
    if( chrc == characteristic )
        throw std::invalid_argument(std::string("GattService1::addCharacteristic '") + charPath + std::string("' already registered!"));
}

characteristics_.push_back( std::move(characteristic) );
includes_.push_back( sdbus::ObjectPath{ charPath } );

}

void GattService1::removeCharacteristic( std::shared_ptr characteristic )
{
const std::string& charPath = characteristic->getPath();

for( auto iter{ characteristics_.cbegin() }; iter != characteristics_.cend(); iter++ )
{
    if( *iter == characteristic )
    {
        characteristics_.erase( iter );
        break;
    }
}

for( auto iter{ includes_.cbegin() }; iter != includes_.cend(); iter++ )
{
    if( *iter == charPath )
    {
        includes_.erase( iter );
        break;
    }
}

}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants