mirror of
https://github.com/mudita/MuditaOS.git
synced 2026-02-06 12:22:00 -05:00
36 lines
1.2 KiB
C++
36 lines
1.2 KiB
C++
// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
|
|
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
|
|
|
|
#include "ApnSettingsModel.hpp"
|
|
#include <service-cellular/PacketDataCellularMessage.hpp>
|
|
#include <service-cellular/ServiceCellular.hpp>
|
|
|
|
ApnSettingsModel::ApnSettingsModel(app::Application *application) : application{application}
|
|
{}
|
|
|
|
void ApnSettingsModel::requestAPNList()
|
|
{
|
|
application->bus.sendUnicast(std::make_shared<CellularGetAPNMessage>(), ServiceCellular::serviceName);
|
|
}
|
|
|
|
void ApnSettingsModel::saveAPN(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(std::shared_ptr<packet_data::APN::Config> apn)
|
|
{
|
|
CellularServiceAPI::DeleteAPN(application, apn->contextId);
|
|
}
|
|
|
|
void ApnSettingsModel::setAsDefaultAPN(std::shared_ptr<packet_data::APN::Config> apn)
|
|
{
|
|
apn->apnType = packet_data::APN::APNType::Default;
|
|
application->bus.sendUnicast(std::make_shared<CellularSetAPNMessage>(apn), ServiceCellular::serviceName);
|
|
}
|