mirror of
https://github.com/mudita/MuditaOS.git
synced 2026-01-16 10:00:03 -05:00
Changes in dependecy managment Replacing state flags with states in ServiceGUI Unifying some parts of code
35 lines
1.1 KiB
C++
35 lines
1.1 KiB
C++
// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved.
|
|
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
|
|
|
|
#include "ApnSettingsModel.hpp"
|
|
#include <service-cellular/ServiceCellular.hpp>
|
|
|
|
ApnSettingsModel::ApnSettingsModel(app::ApplicationCommon *application) : application{application}
|
|
{}
|
|
|
|
void ApnSettingsModel::requestAPNList()
|
|
{
|
|
application->bus.sendUnicast(std::make_shared<cellular::GetAPNMessage>(), service::name::cellular);
|
|
}
|
|
|
|
void ApnSettingsModel::saveAPN(const std::shared_ptr<packet_data::APN::Config> &apn)
|
|
{
|
|
if (apn->contextId != packet_data::EmptyContextId) {
|
|
CellularServiceAPI::SetAPN(application, *apn);
|
|
}
|
|
else {
|
|
CellularServiceAPI::NewAPN(application, *apn);
|
|
}
|
|
}
|
|
|
|
void ApnSettingsModel::removeAPN(const std::shared_ptr<packet_data::APN::Config> &apn)
|
|
{
|
|
CellularServiceAPI::DeleteAPN(application, apn->contextId);
|
|
}
|
|
|
|
void ApnSettingsModel::setAsDefaultAPN(const std::shared_ptr<packet_data::APN::Config> &apn)
|
|
{
|
|
apn->apnType = packet_data::APN::APNType::Default;
|
|
application->bus.sendUnicast(std::make_shared<cellular::SetAPNMessage>(apn), service::name::cellular);
|
|
}
|