일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |
- OpenXLSX 한글
- 확인할 수 없는 외부 기호
- 의존주입
- esp-wroom-32d
- Console
- MFC
- 정적 라이브러리에서 MFC 사용
- c++ Broadcast
- _sprintf
- git 대용량 파일
- OpenCPN
- 사전설치
- Mqtt
- .gitattributes
- OpenCPN설치
- git 최초 설정
- ExtendWith
- winsock.h Broadcast
- Flutter
- wxWidget
- __vsnprintf
- Plugins
- 설치 테스트
- 멀티바이트 문자 집합 사용
- SQLite3
- c++ set struct
- c2678
- __snprintf
- LINK2001
- sts4
- Today
- Total
세상을 이롭게
OpenCPN 개발하기 04. Plugin 준비 및 테스트 본문
OpenCPN 홈페이지에선 기본적인 Plugin 들을 제공한다. 필요하다면 개발을 통해 Plugin을 넣을 수 있다.
그 첫단계를 해보려 한다. 참고해볼 코드들은 아래의 사이트에 가서 github의 소스를 확인해보면 된다.
https://opencpn.org/OpenCPN/info/downloadplugins.html
Plugins for OpenCPN
If you are a developer and would like information on creating plugins and how to get them listed here please see the Plugin Guidelines. OpenCPN Team
opencpn.org
https://opencpn.org/wiki/dokuwiki/doku.php?id=opencpn:developer_manual:plugins
Developer Plugins [OpenCPN Manuals]
opencpn.org
Test용 Plugin 을 만들어 보겠습니다.
속성페이지 - 구성 속성 - 일반 - 구성 형식 을 dll 로 바꾸어 줍니다.
C:\OpenCPN\include;
C:\OpenCPN_SDK\wxWidgets\include;
C:\OpenCPN_SDK\wxWidgets\lib\vc_dll\mswud;
%(AdditionalIncludeDirectories)
WIN32;
_WINDOWS;
__MSVC__;
_CRT_NONSTDC_NO_DEPRECATE;
_CRT_SECURE_NO_DEPRECATE;
UNICODE;
_UNICODE;
WXUSINGDLL;
ocpnUSE_GL;
_DEBUG;
__WXMSW__;
__WXDEBUG__;
_WIN32;
%(PreprocessorDefinitions)
C:\OpenCPN_SDK\wxWidgets\lib\vc_dll;
C:\OpenCPN\build\Debug
opencpn.lib;
wxbase31ud.lib;
wxmsw31ud_core.lib;
wxbase31ud_net.lib;
wxbase31ud_xml.lib;
wxmsw31ud_html.lib;
wxmsw31ud_adv.lib;
wxmsw31ud_aui.lib;
wxmsw31ud_gl.lib;
wxpngd.lib;
wxtiffd.lib;
wxjpegd.lib;
wxzlibd.lib;
wxregexud.lib;
wxexpatd.lib;
opengl32.lib;
glu32.lib;
winmm.lib;
comctl32.lib;
oleacc.lib;
rpcrt4.lib;
shlwapi.lib;
version.lib;
wsock32.lib;
kernel32.lib;
user32.lib;
gdi32.lib;
winspool.lib;
shell32.lib;
ole32.lib;
oleaut32.lib;
uuid.lib;
comdlg32.lib;
advapi32.lib;
%(AdditionalDependencies)
Test_pi.h
#pragma once
#include "ocpn_plugin.h"
#include "wx/wxprec.h"
#define PLUGIN_VERSION_MAJOR 1
#define PLUGIN_VERSION_MINOR 15
#define MY_API_VERSION_MAJOR 1
#define MY_API_VERSION_MINOR 0
class Test_pi : public opencpn_plugin_115
{
public:
Test_pi(void* ppimgr);
~Test_pi(void);
int Init(void);
bool DeInit(void);
int GetAPIVersionMajor() { return PLUGIN_VERSION_MAJOR; }
int GetAPIVersionMinor() { return PLUGIN_VERSION_MINOR; }
int GetPlugInVersionMajor() { return MY_API_VERSION_MAJOR; }
int GetPlugInVersionMinor() { return MY_API_VERSION_MINOR; }
wxString GetCommonName() { return wxS("Test_pi"); }
wxString GetShortDescription() { return wxS("Test_pi"); }
wxString GetLongDescription() { return wxS("Test Plugin"); }
};
Test_pi.cpp
#include "Test_pi.h"
#include <wx/msgdlg.h>
extern "C" DECL_EXP opencpn_plugin * create_pi(void* ppimgr) {
return (opencpn_plugin*) new Test_pi(ppimgr);
}
extern "C" DECL_EXP void destroy_pi(opencpn_plugin * p) {
delete p;
}
Test_pi::Test_pi(void* ppimgr) : opencpn_plugin_115(ppimgr) {
}
Test_pi::~Test_pi(void) {
}
int Test_pi::Init(void) {
wxMessageBox(wxT("Hello World!"));
return(
WANTS_TOOLBAR_CALLBACK |
WANTS_OPENGL_OVERLAY_CALLBACK |
WANTS_NMEA_EVENTS |
WANTS_MOUSE_EVENTS |
WANTS_KEYBOARD_EVENTS |
WANTS_CURSOR_LATLON |
WANTS_ONPAINT_VIEWPORT |
WANTS_CONFIG |
USES_AUI_MANAGER
);
}
bool Test_pi::DeInit(void) {
return true;
}
build 후 생긴 Test_pi.dll 을 C:\OpenCPN\build\plugins 에 넣어준다.
이 작업을 매번 해줘야 하기 때문에 빌드 후 이벤트로 잡아준다.
구성 속성 - 디버깅 - 명령 에 빌드한 opencpn.exe 경로를 써준다. 이렇게 하면 dll 쪽에서 디버깅이 가능하다.
디버거를 실행하여 opencpn.exe 가 정상적으로 실행되는지 확인한다.
이후 좌측 상단의 설정(톱니모양) - Plugins 를 눌러 만들어진 플러그인이 제대로 들어와 있는지 확인한다.
잘 동작함을 확인 할 수 있었다.
필요로 하는 동작만을 넣을 수 있고 Dialog를 띄워 작업 할 수도 있을 것이다.
끝!.
'OpenCPN' 카테고리의 다른 글
OpenCPN 개발하기 04. Plugin 준비 및 테스트(Release) (0) | 2022.04.01 |
---|---|
OpenCPN Plugins 로드에러 (0) | 2022.03.31 |
OpenCPN 개발하기 03. OpenCPN 설치하기 (1) | 2022.01.25 |
OpenCPN 개발하기 02. wxWidgets 설치 (0) | 2022.01.24 |
OpenCPN 개발하기 01.사전설치 (0) | 2021.12.02 |