{"id":21135413,"url":"https://github.com/nohal/nsk_pi","last_synced_at":"2025-07-09T03:33:00.770Z","repository":{"id":137443058,"uuid":"577114681","full_name":"nohal/nsk_pi","owner":"nohal","description":"Simple OpenCPN plugin converting NMEA 0183 sentences into SignalK delta messages","archived":false,"fork":false,"pushed_at":"2024-10-23T16:39:12.000Z","size":7378,"stargazers_count":0,"open_issues_count":1,"forks_count":2,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-10-23T22:59:42.783Z","etag":null,"topics":["chartplotter","navigation","nmea","nmea0183","opencpn","signalk"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nohal.png","metadata":{"files":{"readme":"README.md","changelog":"Changelog.md","contributing":null,"funding":null,"license":"COPYING.bslv1","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-12-12T01:47:38.000Z","updated_at":"2024-10-23T16:39:15.000Z","dependencies_parsed_at":null,"dependency_job_id":"af20c505-7526-4391-aab3-81faf091db49","html_url":"https://github.com/nohal/nsk_pi","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nohal%2Fnsk_pi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nohal%2Fnsk_pi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nohal%2Fnsk_pi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nohal%2Fnsk_pi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nohal","download_url":"https://codeload.github.com/nohal/nsk_pi/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225482021,"owners_count":17481179,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["chartplotter","navigation","nmea","nmea0183","opencpn","signalk"],"created_at":"2024-11-20T06:50:47.528Z","updated_at":"2024-11-20T06:50:48.223Z","avatar_url":"https://github.com/nohal.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"NSK plugin for OpenCPN\n======================\n\nThis project provides a converter of NMEA 0183 messages to SignalK deltas for [OpenCPN](https://opencpn.org) based on the [SignalK](https://signalk.org) data model.\nThe primary purpose of the plugin is to provide data for the [DashboardSK plugin](https://github.com/nohal/dashboardsk_pi) in small installations where a proper SignalK data source is not available.\n\n[![Hosted By: Cloudsmith](https://img.shields.io/badge/OSS%20hosting%20by-cloudsmith-blue?logo=cloudsmith\u0026style=flat-square)](https://cloudsmith.com)\n[![Coverity Scan Build Status](https://scan.coverity.com/projects/27176/badge.svg)](https://scan.coverity.com/projects/nohal-nsk_pi)\n\n## Dependencies\n\nThe plugin uses wxWidgets 3.2 or newer (although building against wxWidgets 3.0 may still be possible until we start to hard-enforce use of wxBitmapBundle) and targets OpenCPN 5.7 or newer with plugin API 1.18.\n\n## Compiling\n\n### Linux/macOS\n\nTo compile this plugin you have to be able to compile OpenCPN itself, refer to the [OpenCPN Developer Manual](https://opencpn-manuals.github.io/main/ocpn-dev-manual/intro-AboutThisManual.html) for instructions on preparing the environment\n\n```bash\ngit clone --recurse-submodules https://github.com/nohal/nsk_pi.git\ncd nsk_pi\nmkdir build\ncd build\ncmake ..\nmake\n```\n\n### Windows\n\nRun `x86 Native Tools Command Prompt for VS 2022` from the Start menu as Administrator\n\n```\ngit clone --recurse-submodules https://github.com/nohal/nsk_pi.git\ncd nsk_pi.git\nci\\appveyor.bat\ncd build\ncmake -A Win32 ..\ncmake --build .\n```\n\nSubsequent runs should not need running the command prompt as Administrator\n\n### Obtaining the Git submodules\n\nIn case you already cloned the repository without the `--recurse-submodules` parameter, execute `git submodule update --init` in the root directory of the source tree.\n\n## Contributing\n\n### General\n\nThe project is developed in C++, specifically C++17.\nPlease format your code using `clang-format` before submitting pull requests, they are checked for compliance with the `.clang-format` file used by the project during the CI workflow and can't be accepted if the test is not passing.\nTo make this as simple as possible, a [pre-commit](https://pre-commit.com) configuration is provided in the project, which activates a Git pre-commit hook taking care of the formatting automatically. To use it run the following commands:\n\n```bash\npip3 install pre-commit\ncd \u003cnsk_pi source directory\u003e\npre-commit install\n```\n\n#### pre-commit on Windows\n\nUse [WSL](https://learn.microsoft.com/en-us/windows/wsl/) for pre-commit and save yourself the headache.\n\n### Documentation\n\nThe code is documented using [Doxygen](https://www.doxygen.nl) style comments. Running `make doxygen-docs` in the build directory generates up to date HTML documentation under `docs`. Please completely document newly added code before submitting pull requests (We started with no warnings about undocumented code being emitted by doxygen and would like to keep it so for the future). Please use English both for naming the entities and documentation and try to name variables in a way describing their purpose. At the other hand, we are not writing a novel here, it is the technical aspect and accuracy of the information that is important.\n\nYou may also run `make asciidoxy-docs` to produce documentation formated using [asciidoxy](https://asciidoxy.org). The intermediate AsciiDoc product is also suitable to be included in the user manual (TODO).\n\nTo be able to do the above follow install the respective tools first...\n\nThe end user documentation integrates to the [OpenCPN plugin documentation framework](https://opencpn-manuals.github.io/plugins/opencpn-plugins/0.1/index.html), is written in [AsciiDoc](https://docs.asciidoctor.org/asciidoc/latest/) and processed using [Antora](https://antora.org) and [AsciiDoctor](https://asciidoctor.org). Please document newly added or changed functionality as soon as it is implemented and try to include the documentation in the same pull request as the code whenever feasible, unfortunately it really won't magically write itelf at some later moment.\n\n### Images\n\nEverything used from the code should be SVG, think at least twice before using a bitmap as the master source of the image. The only place where bitmaps make sense is the documentation.\n\n- Process all the SVG images with [svgo](https://github.com/svg/svgo) - run `svgo --multipass --pretty \u003cyour\u003e.svg` on it\n- Process all PNG images with `oxipng`, `optipng` or similar tool (In case you use `pre-commit` hooks as configured in this repository, the PNG images are optimized automatically before being commited to the repository)\n- Do not use JPEG or any other format using lossy compression for images (Why would you?)\n\n### GUI\n\nThe prototypes for the forms are designed using [wxFormBuilder](https://github.com/wxFormBuilder/wxFormBuilder) and the generated code resides in `include/nskgui.h` and `src/nskgui.cpp`. Never edit the generated files manually.\nThe actual implementation of the GUI functionality is in `include/nskguiimpl.h` and `src/nskguiimpl.cpp`.\nIf you consider it necessary to break the above and feel it is necessary to start writing the whole GUI code by hand, please think it twice and include a bulletproof justification in the description of the respective pull request, as the change will be hardly reversible and we all probably agree that writing GUI completely by hand tends to be little rewarding activity.\n\n### Tests\n\nIt is not a completely bad idea to cover your code with tests where feasible (It is not very feasible for the GUI part, but the logic should usually be pretty well testable). The project uses the current branch of [Catch2](https://github.com/catchorg/Catch2) testing framework (Because we use C++17) and the testcases reside under `tests`.\nBuilding the tests is enabled by default and may be disabled by running cmake `cmake` with `-DWITH_TESTS=OFF` parameter.\nTo execute the tests, simply run `ctest` in the build directory.\n\n### Sanitizers support\n\nTo configure the build to enable sanitizer support, run cmake with `-DSANITIZE=\u003ccomma separated list of sanitizers\u003e, eg. `cmake -DSANITIZE=address ..` to enable the adderess sanitizer reporting memory leaks.\n\n### Adding a new sentence translation\n\n- Add the respective MarNav header file include directive to [nsk.h](https://github.com/nohal/nsk_pi/blob/main/include/nsk.h#L37)\n\n```C++\n#include \u003cmarnav/nmea/gll.hpp\u003e\n```\n\n- Declare the processing function in [nsk.h](https://github.com/nohal/nsk_pi/blob/main/include/nsk.h#L126)\n\n```C++\nvoid ProcessSentence(std::unique_ptr\u003cmarnav::nmea::gll\u003e s,\n      rapidjson::Value\u0026 values_array,\n      rapidjson::Document::AllocatorType\u0026 allocator);\n```\n\n- Implement the converter function in [nsk.cpp](https://github.com/nohal/nsk_pi/blob/main/src/nsk.cpp#L89)\n\n```C++\nvoid NSK::ProcessSentence(std::unique_ptr\u003cmarnav::nmea::gll\u003e s,\n    rapidjson::Value\u0026 values_array,\n    rapidjson::Document::AllocatorType\u0026 allocator)\n{\n    Value val(kObjectType);\n    Value pos(kObjectType);\n    if (s-\u003eget_lat().has_value() \u0026\u0026 s-\u003eget_lon().has_value()) {\n        pos.AddMember(\"latitude\", s-\u003eget_lat()-\u003eget(), allocator);\n        pos.AddMember(\"longitude\", s-\u003eget_lon()-\u003eget(), allocator);\n\n        val.AddMember(\"path\", \"navigation.position\", allocator);\n        val.AddMember(\"value\", pos, allocator);\n        values_array.PushBack(val, allocator);\n    }\n}\n```\n\n- Add a `case` for the newly implemented sentence to the `switch` in `NSK::ProcessNMEASentence(const std::string\u0026 stc)` in [nsk.cpp](https://github.com/nohal/nsk_pi/blob/main/src/nsk.cpp)\n\n```C++\ncase sentence_id::GLL:\n    ProcessSentence(sentence_cast\u003cnmea::gll\u003e(s), values, allocator);\n    break;\n```\n\n- Build and enjoy\n- Write tests\n- Do not forget to run `clang-format` in case you for some reason do not use `pre-commit` recommended above\n- Create a pull request on Github to share your work with the world\n\n## Credits\n\n- This plugin would not be possible without Mario Konrad's excellent https://github.com/mariokonrad/marnav[MarNav] library doing the dirty work of parsing the NMEA 0183 sentences.\n- Thanks to Alec Leamas, Mike Rossiter, Kees Verruijt, Jon Gough and others from whose plugin related work this plugin reuses bits and pieces.\n- Thanks to Dave for OpenCPN\n\n## License\n\nThe MarNav library is licences under BSD license, for details see [marnav/LICENSE](https://github.com/mariokonrad/marnav/blob/master/LICENSE).\n\nThe rapidjson library is licensed under the terms of the MIT License, for details see [license.txt](https://github.com/Tencent/rapidjson/blob/master/license.txt)\n\nThe Catch2 framework is licensed under terms of the Boost Software License 1.0, for details see [LICENSE.txt](https://github.com/catchorg/Catch2/blob/devel/LICENSE.txt)\n\nwxWidgets is licensed under the terms of the wxWindows Library Licence, Version 3.1. For details see [licence.txt](https://github.com/wxWidgets/wxWidgets/blob/master/docs/licence.txt)\n\nOpenCPN is licensed under the terms of the GPLv2+ license, for details see [LICENSING](https://github.com/OpenCPN/OpenCPN/blob/master/LICENSING)\n\nThe `nsk_pi` code is licensed under the terms of the GPL v3, or, at your convenience, newer version of the GPL license. See [LICENSING](https://github.com/nohal/nsk_pi/blob/main/LICENSING) for more details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnohal%2Fnsk_pi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnohal%2Fnsk_pi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnohal%2Fnsk_pi/lists"}