2 * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 ////////////////////////////////////////////////////////////////////////////////////////////////////
18 /// \defgroup <<Group Tag>> <<Group Name>>
19 /// \ingroup tag_NS_NPPService
21 ////////////////////////////////////////////////////////////////////////////////////////////////////
23 ////////////////////////////////////////////////////////////////////////////////////////////////////
24 /// \ingroup tag_NS_NPPService
29 ////////////////////////////////////////////////////////////////////////////////////////////////////
31 ////////////////////////////////////////////////////////////////////////////////////////////////////
33 ////////////////////////////////////////////////////////////////////////////////////////////////////
34 #include <native_service/ns_version.h>
35 #include <native_service/ns_version_if.h>
36 #include <native_service/frameworkunified_dispatcher.h>
37 #include <native_service/frameworkunified_framework_if.h>
43 #include "ns_npp.h" // for static members. Set thread prio.
44 #include "ns_npp_notificationpersistentservicelog.h"
45 #include "ns_npp_persistence_manager.h" // for static members. Set enable/disable persistence feature.
47 const CHAR AppName[] = FRAMEWORKUNIFIED_NS_NPSERVICE; // NOLINT (readability/naming)
48 CHAR g_csendreadyackto[MAX_QUEUE_NAME_SIZE];
50 CFrameworkunifiedVersion g_FrameworkunifiedVersion(MAJORNO, MINORNO, REVISION); // NOLINT (readability/naming)
52 // Argument Parser for NSNPP
53 EFrameworkunifiedStatus NPPArgumentParser(SI_32 f_iargument, PCHAR f_pargumentvalue);
55 FRAMEWORKUNIFIEDLOGPARAM g_FrameworkunifiedLogParams = { // NOLINT (readability/naming)
56 FRAMEWORKUNIFIEDLOGOPTIONS,
58 ZONE_TEXT_10, ZONE_TEXT_11, ZONE_TEXT_12,
59 ZONE_TEXT_13, ZONE_TEXT_14, ZONE_TEXT_15,
60 ZONE_TEXT_16, ZONE_TEXT_17, ZONE_TEXT_18,
61 ZONE_TEXT_19, ZONE_TEXT_20, ZONE_TEXT_21,
62 ZONE_TEXT_22, ZONE_TEXT_23, ZONE_TEXT_24,
63 ZONE_TEXT_25, ZONE_TEXT_26, ZONE_TEXT_27,
64 ZONE_TEXT_28, ZONE_TEXT_29, ZONE_TEXT_30,
67 FRAMEWORKUNIFIEDLOGZONES
70 extern const FrameworkunifiedDefaultCallbackHandler kDefaultCbHandler;
73 ////////////////////////////////////////////////////////////////////////////////////////////////////
75 ////////////////////////////////////////////////////////////////////////////////////////////////////
77 int main(int argc, char *argv[]) {
78 FRAMEWORKUNIFIED_SET_ZONES();
79 CustomCommandLineOptions l_tcmdlineoptions = { "i:e:w:fa:v:", NULL, NPPArgumentParser};
80 EFrameworkunifiedStatus l_estatus = FrameworkunifiedDispatcherWithArguments(AppName, argc, argv, &kDefaultCbHandler, &l_tcmdlineoptions);
82 return static_cast<SI_32>(l_estatus);
85 EFrameworkunifiedStatus NPPArgumentParser(SI_32 f_iargument, PCHAR f_pargumentvalue) {
86 EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
87 SI_32 l_iTmpArgValue = 0;
88 switch (f_iargument) { // LCOV_EXCL_BR_LINE 8: cannot test
89 // Disable Persistence
91 CPersistenceManager::m_bPersistenceDisabled = TRUE;
95 l_iTmpArgValue = atoi(f_pargumentvalue);
96 if (l_iTmpArgValue > 0) { // LCOV_EXCL_BR_LINE 8: cannot test
97 CNSNPP::m_siImmediatePersistenceThreadPrio = l_iTmpArgValue;
102 l_iTmpArgValue = atoi(f_pargumentvalue);
103 if (l_iTmpArgValue > 0) { // LCOV_EXCL_BR_LINE 8: cannot test
104 CNSNPP::m_siReadThreadPrio = l_iTmpArgValue;
109 l_iTmpArgValue = atoi(f_pargumentvalue);
110 if (l_iTmpArgValue > 0) { // LCOV_EXCL_BR_LINE 8: cannot test
111 CNSNPP::m_siWriteThreadPrio = l_iTmpArgValue;
116 std::memset(g_csendreadyackto, 0, MAX_QUEUE_NAME_SIZE);
117 std::strncpy(g_csendreadyackto, f_pargumentvalue, (MAX_QUEUE_NAME_SIZE - 1));
121 l_iTmpArgValue = atoi(f_pargumentvalue);
122 CNSNPP::m_siCRCCheckCount = static_cast<UI_16>(l_iTmpArgValue);
127 l_estatus = eFrameworkunifiedStatusFail;