// Copyright (c) 2017-2020, Mudita Sp. z.o.o. All rights reserved. // For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md #include "config.h" // applications #include #include #include #include #include #include #include #include #include #include #include #include #include #include // services #include #include #include #include #include #include #include #include #include #include #if ENABLE_GSM == 1 #include #include #include #endif #include #include #include #include #include #include #include #include #include #include #include class vfs vfs; int main() { #if SYSTEM_VIEW_ENABLED SEGGER_SYSVIEW_Conf(); SEGGER_SYSVIEW_DisableEvents(SYSVIEW_EVTMASK_ISR_ENTER); SEGGER_SYSVIEW_DisableEvents(SYSVIEW_EVTMASK_ISR_EXIT); SEGGER_SYSVIEW_DisableEvents(SYSVIEW_EVTMASK_ISR_TO_SCHEDULER); SEGGER_SYSVIEW_WaitForConnection(); SEGGER_SYSVIEW_Start(); #endif bsp::BoardInit(); auto sysmgr = std::make_shared(5000); sysmgr->StartSystem([sysmgr]() { /// force initialization of PhonenumberUtil because of its stack usage /// otherwise we would end up with an init race and PhonenumberUtil could /// be initiated in a task with stack not big enough to handle it i18n::phonenumbers::PhoneNumberUtil::GetInstance(); vfs.Init(); auto ret = true; ret &= sys::SystemManager::CreateService(std::make_shared(service::name::evt_manager), sysmgr.get()); #if ENABLE_FILEINDEXER_SERVICE ret &= sys::SystemManager::CreateService( std::make_shared(service::name::file_indexer), sysmgr.get()); #endif ret &= sys::SystemManager::CreateService(std::make_shared(), sysmgr.get()); #if ENABLE_GSM == 0 // For now disable pernamenlty Service cellular when there is no GSM configured LOG_INFO("ServiceCellular (GSM) - Disabled"); #else LOG_INFO("ServiceCellular (GSM) - Enabling"); ret &= sys::SystemManager::CreateService(std::make_shared(), sysmgr.get()); ret &= sys::SystemManager::CreateService(std::make_shared(), sysmgr.get()); ret &= sys::SystemManager::CreateService(std::make_shared(), sysmgr.get()); #endif ret &= sys::SystemManager::CreateService(std::make_shared(), sysmgr.get()); ret &= sys::SystemManager::CreateService(std::make_shared(), sysmgr.get()); ret &= sys::SystemManager::CreateService(std::make_shared(), sysmgr.get()); ret &= sys::SystemManager::CreateService(std::make_shared(), sysmgr.get()); ret &= sys::SystemManager::CreateService(std::make_shared(), sysmgr.get()); // vector with launchers to applications std::vector> applications; #ifdef ENABLE_APP_DESKTOP applications.push_back(app::CreateLauncher(app::name_desktop, false)); #endif #ifdef ENABLE_APP_CALL applications.push_back(app::CreateLauncher(app::name_call, false)); #endif #ifdef ENABLE_APP_SETTINGS applications.push_back(app::CreateLauncher(app::name_settings)); #endif #ifdef ENABLE_APP_SETTINGS_NEW applications.push_back(app::CreateLauncher(app::name_settings_new)); #endif #ifdef ENABLE_APP_NOTES applications.push_back(app::CreateLauncher(app::name_notes)); #endif #ifdef ENABLE_APP_CALLLOG applications.push_back(app::CreateLauncher(app::CallLogAppStr)); #endif #ifdef ENABLE_APP_PHONEBOOK applications.push_back(app::CreateLauncher(app::name_phonebook)); #endif #ifdef ENABLE_APP_MESSAGES applications.push_back(app::CreateLauncher(app::name_messages)); #endif #ifdef ENABLE_APP_SPECIAL_INPUT applications.push_back(app::CreateLauncher(app::special_input, false)); #endif #ifdef ENABLE_APP_ANTENNA applications.push_back(app::CreateLauncher(app::name_antenna)); #endif #ifdef ENABLE_APP_CALENDAR applications.push_back(app::CreateLauncher(app::name_calendar)); #endif #ifdef ENABLE_APP_MUSIC_PLAYER applications.push_back(app::CreateLauncher(app::name_music_player)); #endif #ifdef ENABLE_APP_MEDITATION applications.push_back(app::CreateLauncher(app::name_meditation)); #endif #ifdef ENABLE_APP_CALCULATOR applications.push_back(app::CreateLauncher(app::name_calculator)); #endif // start application manager ret &= sysmgr->CreateService( std::make_shared( app::manager::ApplicationManager::ServiceName, std::move(applications), app::name_desktop), sysmgr.get()); return ret; }); LOG_PRINTF("Launching PurePhone \n"); LOG_PRINTF("commit: %s tag: %s branch: %s\n", GIT_REV, GIT_TAG, GIT_BRANCH); cpp_freertos::Thread::StartScheduler(); return 1; }