From 45efb06aa23859bc4be5c62f960dae5c6d025268 Mon Sep 17 00:00:00 2001 From: Mario Fink Date: Tue, 29 Jun 2021 12:38:55 +0200 Subject: [PATCH] add support for NL key, issue #6 --- cython/setup.py | 2 +- lib/imc_channel.hpp | 27 ++++++++++++++++++++++++--- lib/imc_key.hpp | 3 ++- lib/imc_raw.hpp | 1 + pip/setup.py | 2 +- 5 files changed, 29 insertions(+), 6 deletions(-) diff --git a/cython/setup.py b/cython/setup.py index b2bf9b4..94db597 100644 --- a/cython/setup.py +++ b/cython/setup.py @@ -15,7 +15,7 @@ extensions = Extension( setup( name="imc_termite", - version='1.2.5', + version='1.2.6', description='IMCtermite cython extension', author='Record Evolution GmbH', author_email='mario.fink@record-evolution.de', diff --git a/lib/imc_channel.hpp b/lib/imc_channel.hpp index 90f27a0..f7cca7a 100644 --- a/lib/imc_channel.hpp +++ b/lib/imc_channel.hpp @@ -20,7 +20,7 @@ namespace imc // collect affiliate blocks for a single channel std::string CBuuid_, CGuuid_, CCuuid_, CNuuid_; std::string CDuuid_, CTuuid_, Cbuuid_, CPuuid_, CRuuid_, CSuuid_; - std::string NTuuid_, NOuuid_; + std::string NTuuid_, NOuuid_, NLuuid_; // reset all members void reset() @@ -38,6 +38,7 @@ namespace imc CSuuid_.clear(); NTuuid_.clear(); NOuuid_.clear(); + NLuuid_.clear(); } // get info @@ -58,7 +59,8 @@ namespace imc <* buffer_; // collect meta-data of channels according to env, - // just everything valueable in here + // just everything valueable in here std::string uuid_; std::string name_, comment_; std::string origin_, origin_comment_, text_; + std::string language_code_, codepage_; std::string yname_, yunit_; std::string xname_, xunit_; double xstepwidth_, xoffset_; @@ -233,6 +237,19 @@ namespace imc origin_comment_ = blocks_->at(chnenv_.NOuuid_).get_parameter(prms[6]); } + // extract associated NL data + // codepage: + // - http://www.iana.org/assignments/character-sets/character-sets.xhtml + // - https://de.wikipedia.org/wiki/Zeichensatztabelle + // language-code: + // - https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-lcid/a9eac961-e77d-41a6-90a5-ce1a8b0cdb9c?redirectedfrom=MSDN + if ( blocks_->count(chnenv_.NLuuid_) == 1 ) + { + prms = blocks_->at(chnenv_.NLuuid_).get_parameters(); + codepage_ = blocks_->at(chnenv_.NLuuid_).get_parameter(prms[2]); + language_code_ = blocks_->at(chnenv_.NLuuid_).get_parameter(prms[3]); + } + // start converting binary buffer to imc::datatype if ( !chnenv_.CSuuid_.empty() ) convert_buffer(); } @@ -330,6 +347,8 @@ namespace imc <