~aleteoryx/muditaos

6b50d03d526d082ac05e741febe44de195327356 — Bartosz Cichocki 4 years ago 2b3fc0d
[EGD-7097] Introduce BT name length limit

There was no length limit for BT name which could cause crash
Now it's set to 248 bytes, according to the BT docs
M module-apps/application-settings-new/windows/PhoneNameWindow.cpp => module-apps/application-settings-new/windows/PhoneNameWindow.cpp +1 -1
@@ 43,9 43,9 @@ namespace gui

    void PhoneNameWindow::onBeforeShow(ShowMode /*mode*/, SwitchData *data)
    {
        inputField->clear();
        if (const auto newData = dynamic_cast<PhoneNameData *>(data); data != nullptr) {
            inputField->setText(newData->getName());
            inputField->setTextLimitType(gui::TextLimitType::MaxSignsCount, maxNameLength);
        }
    }


M module-apps/application-settings-new/windows/PhoneNameWindow.hpp => module-apps/application-settings-new/windows/PhoneNameWindow.hpp +2 -0
@@ 21,6 21,8 @@ namespace gui

        Text *inputField = nullptr;
        std::unique_ptr<BluetoothSettingsModel> bluetoothSettingsModel;

        static constexpr auto maxNameLength = 248; // Max 248 bytes according to Bluetooth Core Specification v5.2
    };

} /* namespace gui */