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 /// \ingroup tag_NS_InterfaceunifiedLogCapture
19 /// \brief Class that threads for usb, and readers use to AGL and get
20 /// information from the parent.
22 ///////////////////////////////////////////////////////////////////////////////
24 #include <loggerservicedebug_thread_if.h>
27 const CHAR g_strLogQueReaderWorkerName[] = "pdg.LogQueR";
28 const CHAR g_strTransmitQueReaderWorkerName[] = "pdg.TransQueR";
29 const CHAR g_strPerformanceQueReaderWorkerName[] = "pdg.PerformQueR";
30 const CHAR g_strUsbEjectWorkerName[] = "pdg.UsbEject";
31 const CHAR g_strUsbLogCaptureWorkerName[] = "pdg.UsbLogCapt";
32 const CHAR g_strCaptureLogScriptExeName[] = "pdg.CaptLogScri";
34 LoggerserviceDebugChildThread::LoggerserviceDebugChildThread() {
35 names[LoggerserviceDebugChildThread::kLoggerserviceDebugLogQueReader] =
36 g_strLogQueReaderWorkerName;
37 names[LoggerserviceDebugChildThread::kLoggerserviceDebugTransmitQueReader] =
38 g_strTransmitQueReaderWorkerName;
39 names[LoggerserviceDebugChildThread::kLoggerserviceDebugCaptureLogScript] =
40 g_strCaptureLogScriptExeName;
41 names[LoggerserviceDebugChildThread::kLoggerservicePerformanceLogQueReader] =
42 g_strPerformanceQueReaderWorkerName;
44 threads[LoggerserviceDebugChildThread::kLoggerserviceDebugLogQueReader] = NULL;
45 threads[LoggerserviceDebugChildThread::kLoggerserviceDebugTransmitQueReader] = NULL;
46 threads[LoggerserviceDebugChildThread::kLoggerserviceDebugCaptureLogScript] = NULL;
47 threads[LoggerserviceDebugChildThread::kLoggerservicePerformanceLogQueReader] = NULL;
48 } // LCOV_EXCL_BR_LINE 10:the last line
50 LoggerserviceDebugChildThread::~LoggerserviceDebugChildThread() { // LCOV_EXCL_START 14:global instance
51 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
55 BOOL LoggerserviceDebugChildThread::Start(ELoggerserviceDebugThreads id, const char* parentsName,
56 const char * sendDataToQue,
57 void* (*routine)(void*),
58 const char * sendToUdpQue) { // LCOV_EXCL_START 7:debug code
59 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
61 if (id < LoggerserviceDebugChildThread::kLoggerserviceDebugMax && id > -1) {
62 if (threads[id] == NULL) {
64 != (threads[id] = new (std::nothrow) CChild(parentsName,
67 routine, sendToUdpQue))) {
79 void LoggerserviceDebugChildThread::Stop(ELoggerserviceDebugThreads id) { // LCOV_EXCL_START 7:debug code
80 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
81 if (id < LoggerserviceDebugChildThread::kLoggerserviceDebugMax && id > -1) {
82 if (threads[id] != NULL) {
90 BOOL LoggerserviceDebugChildThread::Running(ELoggerserviceDebugThreads id) const { // LCOV_EXCL_START 7:debug code
91 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
93 if (id < LoggerserviceDebugChildThread::kLoggerserviceDebugMax && id > -1) {
94 if (threads[id] != NULL) {
103 void LoggerserviceDebugChildThread::StopAll() { // LCOV_EXCL_START 7:debug code
104 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
105 for (int id = kLoggerserviceDebugLogQueReader; id < kLoggerserviceDebugMax; id++) {
106 if (threads[id] != NULL) {
115 const char * LoggerserviceDebugChildThread::Name(ELoggerserviceDebugThreads id) { // LCOV_EXCL_START 7:debug code
116 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
117 if (id < LoggerserviceDebugChildThread::kLoggerserviceDebugMax && id > -1) {
118 return names[id].c_str();
125 void LoggerserviceDebugChildThread::LiftWaitBarrier(ELoggerserviceDebugThreads id) { // LCOV_EXCL_START 7:debug code
126 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
127 if (id < LoggerserviceDebugChildThread::kLoggerserviceDebugMax && id > -1) {
128 if (threads[id] != NULL) {
129 threads[id]->IsValidWaitBarrier();