Skip to content

Commit 5f3ada7

Browse files
authored
[EGD-3852] convert to libs services: gui, eink (#933)
1 parent 94378c7 commit 5f3ada7

22 files changed

+237
-309
lines changed

module-gui/CMakeLists.txt

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 3.12)
1+
cmake_minimum_required(VERSION 3.12)
22

33

44
project(module-gui VERSION 1.0
@@ -35,10 +35,9 @@ target_link_options(${PROJECT_NAME} PUBLIC ${TARGET_LINK_OPTIONS})
3535

3636

3737
target_include_directories(${PROJECT_NAME}
38-
39-
PUBLIC
40-
38+
PUBLIC
4139
${CMAKE_CURRENT_SOURCE_DIR}
40+
${CMAKE_CURRENT_SOURCE_DIR}/gui/core
4241
)
4342

4443

module-services/CMakeLists.txt

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
cmake_minimum_required(VERSION 3.14)
2-
3-
project(module-services VERSION 1.0
1+
project(module-services VERSION 1.0
42
DESCRIPTION "Library with all services.")
53

64
include(${CMAKE_SOURCE_DIR}/module-lwip/lwip-includes.cmake)
@@ -14,10 +12,12 @@ else()
1412
message(FATAL_ERROR "Invalid target!")
1513
endif()
1614

15+
include_directories(${CMAKE_CURRENT_LIST_DIR})
16+
1717
add_library(${PROJECT_NAME} STATIC ${SOURCES} ${BOARD_SOURCES})
1818

19-
add_subdirectory( service-gui )
2019
add_subdirectory( service-eink )
20+
add_subdirectory( service-gui )
2121
add_subdirectory( service-evtmgr )
2222
add_subdirectory( service-appmgr )
2323
add_subdirectory( service-db )
@@ -30,7 +30,19 @@ add_subdirectory( service-fota )
3030
add_subdirectory( service-antenna )
3131
add_subdirectory( service-time )
3232

33-
target_link_libraries(${PROJECT_NAME} PUBLIC module-bsp module-os module-sys module-utils module-gui module-apps module-db module-cellular module-audio ${TARGET_LIBRARIES} )
33+
target_link_libraries(${PROJECT_NAME} PUBLIC
34+
service-eink
35+
service-gui
36+
module-bsp
37+
module-os
38+
module-sys
39+
module-utils
40+
module-gui
41+
module-apps
42+
module-db
43+
module-cellular
44+
module-audio
45+
${TARGET_LIBRARIES} )
3446

3547
# Board specific compilation definitions,options,include directories and features
3648
target_compile_definitions(${PROJECT_NAME} PUBLIC ${PROJECT_CONFIG_DEFINITIONS})
Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
1+
project(service-eink)
2+
message( "${PROJECT_NAME} ${CMAKE_CURRENT_LIST_DIR}" )
23
if(${PROJECT_TARGET} STREQUAL "TARGET_RT1051")
34
set( EINK_BOARD_PATH "board/rt1051" )
45
elseif(${PROJECT_TARGET} STREQUAL "TARGET_Linux")
5-
set(CMAKE_CXX_STANDARD 17)
66
set( EINK_BOARD_PATH "board/linux" )
77
add_subdirectory( "board/linux/renderer" )
88
else()
@@ -11,27 +11,23 @@ endif()
1111

1212
message( "EINK BOARD PATH: ${CMAKE_CURRENT_LIST_DIR}/${EINK_BOARD_PATH}" )
1313

14-
include_directories( ${CMAKE_PROJECT_NAME}
14+
add_library(${PROJECT_NAME} STATIC)
1515

16-
PUBLIC
17-
"${CMAKE_CURRENT_LIST_DIR}"
18-
"${CMAKE_CURRENT_LIST_DIR}/messages"
19-
"${CMAKE_CURRENT_LIST_DIR}/${EINK_BOARD_PATH}"
16+
target_link_libraries( ${PROJECT_NAME}
17+
module-utils
18+
service-gui
2019
)
2120

22-
include_directories( ${PROJECT_NAME}
23-
24-
PUBLIC
25-
"${CMAKE_CURRENT_LIST_DIR}"
26-
"${CMAKE_CURRENT_LIST_DIR}/messages"
27-
"${CMAKE_CURRENT_LIST_DIR}/${EINK_BOARD_PATH}"
28-
# "${CMAKE_CURRENT_LIST_DIR}/../"
21+
target_include_directories(${PROJECT_NAME}
22+
PUBLIC
23+
"${CMAKE_CURRENT_LIST_DIR}"
24+
"${CMAKE_CURRENT_LIST_DIR}/messages"
25+
"${CMAKE_CURRENT_LIST_DIR}/${EINK_BOARD_PATH}"
2926
)
3027

3128
target_sources( ${PROJECT_NAME}
32-
33-
PRIVATE
34-
"${CMAKE_CURRENT_LIST_DIR}/ServiceEink.cpp"
35-
"${CMAKE_CURRENT_LIST_DIR}/messages/ImageMessage.cpp"
29+
PRIVATE
30+
ServiceEink.cpp
31+
messages/ImageMessage.cpp
3632
)
3733

module-services/service-eink/ServiceEink.cpp

Lines changed: 13 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,19 @@
1-
// Copyright (c) 2017-2020, Mudita Sp. z.o.o. All rights reserved.
1+
// Copyright (c) 2017-2020, Mudita Sp. z.o.o. All rights reserved.
22
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
33

4-
/*
5-
* ServiceEink.cpp
6-
*
7-
* Created on: 22 maj 2019
8-
* Author: robert
9-
*/
10-
11-
// FreeRTOS
12-
extern "C"
13-
{
14-
}
15-
#include <stdio.h> // for SEEK_SET
16-
#include <string.h> // for memset, memcpy
17-
#include <memory> // for make_shared, allocator
18-
19-
// module-utils
20-
#include "log/log.hpp" // for LOG_FATAL, LOG_ERROR, LOG_DEBUG, LOG_INFO
21-
// module-vfs
22-
#include "vfs.hpp" // for vfs
23-
// eink messages
24-
#include "messages/EinkMessage.hpp" // for EinkMessage
25-
#include "messages/ImageMessage.hpp" // for ImageMessage
26-
#include "service-gui/messages/GUIMessage.hpp" // for GUIMessage
27-
#include "MessageType.hpp" // for MessageType, MessageType::GUIDisplayReady, MessageType::EinkDMATransfer, MessageType::EinkImageData, MessageType::EinkStateRequest, MessageType::EinkTemperatureUpdate
284
#include "ServiceEink.hpp"
29-
#include "Service/Bus.hpp" // for Bus
5+
6+
#include <log/log.hpp>
7+
#include <messages/EinkMessage.hpp>
8+
#include <messages/ImageMessage.hpp>
9+
#include <MessageType.hpp>
10+
#include <Service/Bus.hpp>
11+
#include <service-gui/messages/GUIMessage.hpp>
12+
#include <vfs.hpp>
13+
14+
#include <cstdio>
15+
#include <cstring>
16+
#include <memory>
3017

3118
enum class EinkWorkerCommands
3219
{

module-services/service-eink/ServiceEink.hpp

Lines changed: 8 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,16 @@
11
// Copyright (c) 2017-2020, Mudita Sp. z.o.o. All rights reserved.
22
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
33

4-
/*
5-
* ServiceGUI.hpp
6-
*
7-
* Created on: 22 maj 2019
8-
* Author: robert
9-
*/
4+
#pragma once
105

11-
#ifndef MODULE_SERVICES_SERVICE_EINK_SERVICEEINK_HPP_
12-
#define MODULE_SERVICES_SERVICE_EINK_SERVICEEINK_HPP_
6+
#include <EinkIncludes.hpp>
7+
#include <Service/Common.hpp>
8+
#include <Service/Message.hpp>
9+
#include <Service/Service.hpp>
10+
#include <Service/Timer.hpp>
1311

14-
//#include "board.h"
15-
16-
#include <stdint.h> // for uint32_t, int32_t, int8_t, uint8_t
17-
#include <string> // for string, allocator
18-
19-
#include "Service/Service.hpp" // for Service
20-
#include "Service/Message.hpp" // for Message_t, DataMessage (ptr only), ResponseMessage (ptr only)
21-
// eink bsp
22-
#include "EinkIncludes.hpp" // for EinkWaveFormSettings_t, EinkWaveforms_e
23-
#include "Service/Timer.hpp" // for Timer, ms
24-
#include "Service/Common.hpp" // for ReturnCodes, ServicePowerMode
12+
#include <cstdint>
13+
#include <string>
2514

2615
class ServiceEink : public sys::Service
2716
{
@@ -74,5 +63,3 @@ class ServiceEink : public sys::Service
7463

7564
sys::ReturnCodes SwitchPowerModeHandler(const sys::ServicePowerMode mode) override final;
7665
};
77-
78-
#endif /* MODULE_SERVICES_SERVICE_EINK_SERVICEEINK_HPP_ */

module-services/service-eink/board/linux/renderer/src/RArea.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
// Copyright (c) 2017-2020, Mudita Sp. z.o.o. All rights reserved.
1+
// Copyright (c) 2017-2020, Mudita Sp. z.o.o. All rights reserved.
22
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
33

4-
#include <cairomm/context.h> // for Context
5-
#include <gdkmm/pixbuf.h> // for Pixbuf, COLORSPACE_RGB
6-
#include <glib.h> // for guchar
7-
84
#include "RArea.hpp"
9-
#include "cairomm/refptr.h" // for RefPtr
10-
#include "gdkmm/general.h" // for set_source_pixbuf
11-
#include "glibmm/refptr.h" // for RefPtr
12-
#include "gtkmm/widget.h" // for Allocation
5+
6+
#include <cairomm/context.h>
7+
#include <cairomm/refptr.h>
8+
#include <gdkmm/general.h>
9+
#include <gdkmm/pixbuf.h>
10+
#include <gtkmm/widget.h>
11+
#include <glibmm/refptr.h>
12+
#include <glib.h>
1313

1414
RArea::RArea() : data{nullptr}
1515
{}

module-services/service-eink/board/linux/renderer/src/RArea.hpp

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,11 @@
1-
// Copyright (c) 2017-2020, Mudita Sp. z.o.o. All rights reserved.
1+
// Copyright (c) 2017-2020, Mudita Sp. z.o.o. All rights reserved.
22
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
33

4-
/*
5-
* RArea.hpp
6-
*
7-
* Created on: 24 kwi 2019
8-
* Author: robert
9-
*/
10-
11-
#ifndef RENDERER_RAREA_HPP_
12-
#define RENDERER_RAREA_HPP_
4+
#pragma once
135

146
#include <cairomm/context.h>
157
#include <gtkmm.h>
16-
#include <gtkmm/drawingarea.h> // for DrawingArea
8+
#include <gtkmm/drawingarea.h>
179

1810
namespace Cairo
1911
{
@@ -36,5 +28,3 @@ class RArea : public Gtk::DrawingArea
3628
char *data;
3729
bool on_draw(const Cairo::RefPtr<Cairo::Context> &cr) override;
3830
};
39-
40-
#endif /* RENDERER_RAREA_HPP_ */

module-services/service-eink/board/linux/renderer/src/RWindow.cpp

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,20 @@
1-
// Copyright (c) 2017-2020, Mudita Sp. z.o.o. All rights reserved.
1+
// Copyright (c) 2017-2020, Mudita Sp. z.o.o. All rights reserved.
22
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
33

4-
#include <glib.h> // for g_timeout_add, gboolean, gpointer
5-
#include <stddef.h> // for size_t
6-
#include <unistd.h> // for write, ssize_t
7-
/*
8-
* RWindow.cpp
9-
*
10-
* Created on: 24 kwi 2019
11-
* Author: robert
12-
*/
13-
#include <map> // for map, operator!=, _Rb_tree_iterator<>::_Self, map<>::iterator, operator==, _Rb_tree_iterator
14-
#include <utility> // for pair
15-
164
#include "RWindow.hpp"
17-
#include "module-bsp/bsp/keyboard/key_codes.hpp" // for KeyCodes, KeyCodes::FnLeft, KeyCodes::FnRight, KeyCodes::JoystickDown, KeyCodes::JoystickEnter, KeyCodes::JoystickLeft, KeyCodes::JoystickRight, KeyCodes::JoystickUp, KeyCodes::NumericKey0, KeyCodes::NumericKey1, KeyCodes::NumericKey2, KeyCodes::NumericKey3, KeyCodes::NumericKey4, KeyCodes::NumericKey5, KeyCodes::NumericKey6, KeyCodes::NumericKey7, KeyCodes::NumericKey8, KeyCodes::NumericKey9, KeyCodes::NumericKeyAst, KeyCodes::NumericKeyPnd, KeyCodes::SSwitchDown, KeyCodes::SSwitchMid, KeyCodes::SSwitchUp, KeyCodes::Torch, KeyCodes::VolDown, KeyCodes::VolUp
18-
#include "module-bsp/bsp/common.hpp" // for KeyEvents, KeyEvents::Pressed, KeyEvents::Released
19-
#include "glibmm/signalproxy.h" // for SignalProxy
20-
#include "module-services/service-eink/board/linux/renderer/src/RArea.hpp" // for RArea
21-
#include "sigc++/functors/mem_fun.h" // for bound_mem_functor1, mem_fun
5+
6+
#include <module-bsp/bsp/common.hpp>
7+
#include <module-bsp/bsp/keyboard/key_codes.hpp>
8+
#include <module-services/service-eink/board/linux/renderer/src/RArea.hpp>
9+
10+
#include <glibmm/signalproxy.h>
11+
#include <sigc++/functors/mem_fun.h>
12+
13+
#include <cstddef>
14+
#include <glib.h>
15+
#include <map>
16+
#include <unistd.h>
17+
#include <utility>
2218

2319
static gboolean viewUpdate(gpointer data)
2420
{

module-services/service-eink/board/linux/renderer/src/RWindow.hpp

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,19 @@
1-
// Copyright (c) 2017-2020, Mudita Sp. z.o.o. All rights reserved.
1+
// Copyright (c) 2017-2020, Mudita Sp. z.o.o. All rights reserved.
22
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
33

4-
/*
5-
* RWindow.hpp
6-
*
7-
* Created on: 24 kwi 2019
8-
* Author: robert
9-
*/
4+
#pragma once
105

11-
#ifndef RENDERER_RWINDOW_HPP_
12-
#define RENDERER_RWINDOW_HPP_
6+
#include "RArea.hpp"
137

8+
#include <module-bsp/bsp/keyboard/key_codes.hpp>
9+
10+
#include <gdk/gdk.h>
1411
#include <gtkmm.h>
1512
#include <gtkmm/drawingarea.h>
16-
#include <gdk/gdk.h> // for GdkEventKey
17-
#include <map> // for map
18-
#include <cstdint> // for uint32_t, int8_t
13+
#include <gtkmm/window.h>
1914

20-
#include "RArea.hpp" // for RArea
21-
#include "module-bsp/bsp/keyboard/key_codes.hpp"
22-
#include "gtkmm/window.h" // for Window
15+
#include <cstdint>
16+
#include <map>
2317

2418
class RWindow : public Gtk::Window
2519
{
@@ -52,5 +46,3 @@ class RWindow : public Gtk::Window
5246

5347
void updateDrawBuffer();
5448
};
55-
56-
#endif /* RENDERER_RWINDOW_HPP_ */

module-services/service-eink/board/linux/renderer/src/gui_renderer.cpp

Lines changed: 16 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,21 @@
1-
// Copyright (c) 2017-2020, Mudita Sp. z.o.o. All rights reserved.
1+
// Copyright (c) 2017-2020, Mudita Sp. z.o.o. All rights reserved.
22
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
33

4-
//============================================================================
5-
// Name : pure-gui.cpp
6-
// Author :
7-
// Version :
8-
// Copyright : Your copyright notice
9-
// Description : Hello World in C++, Ansi-style
10-
//============================================================================
11-
12-
#include <sys/mman.h> // for mmap, shm_open, MAP_FAILED, MAP_SHARED, PROT_READ, PROT_WRITE
13-
#include <sys/stat.h> // for mkfifo
14-
#include <fcntl.h> // for open, O_WRONLY, O_NONBLOCK, O_CREAT, O_RDWR
15-
#include <unistd.h> // for ftruncate
16-
#include <gtkmm/application.h> // for Application
17-
#include <errno.h> // for errno
18-
#include <stdint.h> // for uint32_t, uint8_t
19-
#include <iostream> // for operator<<, basic_ostream, endl, char_traits, ostream, cerr, cout, std
20-
#include <cstring> // for strerror, NULL
21-
#include <string> // for string, allocator
22-
23-
#include "RWindow.hpp" // for RWindow
24-
#include "glibmm/refptr.h" // for RefPtr
4+
#include "RWindow.hpp"
5+
6+
#include <glibmm/refptr.h>
7+
#include <fcntl.h>
8+
#include <gtkmm/application.h>
9+
#include <sys/mman.h>
10+
#include <sys/stat.h>
11+
12+
#include <unistd.h>
13+
14+
#include <cstdint>
15+
#include <cstring>
16+
#include <errno.h>
17+
#include <iostream>
18+
#include <string>
2519

2620
using namespace std;
2721

0 commit comments

Comments
 (0)