示例#1
0
void OSSIADevice::updateAddress(
        const State::Address& currentAddr,
        const Device::FullAddressSettings &settings)
{
    if(!connected())
        return;

    OSSIA::Node* node = getNodeFromPath(currentAddr.path, m_dev.get());
    auto newName = settings.address.path.last().toStdString();
    if(newName != node->getName())
    {
        node->setName(newName);
    }

    if(settings.value.val.which() == State::ValueType::NoValue)
    {
        removeOSSIAAddress(node);
    }
    else
    {
        auto currentAddr = node->getAddress();
        if(currentAddr)
            updateOSSIAAddress(settings, node->getAddress());
        else
            createOSSIAAddress(settings, node);
    }
}
示例#2
0
void OSSIADevice::updateAddress(const FullAddressSettings &settings)
{
    using namespace OSSIA;
    QStringList path = settings.name.split("/");
    path.removeFirst();
    path.removeFirst();

    OSSIA::Node* node = createNodeFromPath(path, m_dev.get());
    updateOSSIAAddress(settings, node->getAddress());
}