mirror of
https://github.com/eclipse-openvehicle-api/openvehicle-api.git
synced 2026-02-05 15:18:45 +00:00
asc file reader and small log enhancements (#3)
This commit is contained in:
@@ -6,25 +6,18 @@
|
|||||||
#ifndef SIGNAL_NAMES_H
|
#ifndef SIGNAL_NAMES_H
|
||||||
#define SIGNAL_NAMES_H
|
#define SIGNAL_NAMES_H
|
||||||
|
|
||||||
#ifdef __has_include
|
|
||||||
#if __has_include("../interfaces/signal_identifier.h")
|
|
||||||
#include "../interfaces/signal_identifier.h"
|
|
||||||
#else
|
|
||||||
|
|
||||||
namespace doors
|
namespace doors
|
||||||
{
|
{
|
||||||
// Data Dispatch Service signal names to dbc variable names C-type RX/TX vss name space
|
// Data Dispatch Service signal names to dbc variable names C-type RX/TX vss name space
|
||||||
static std::string dsLeftDoorIsOpen01 = "CAN_Input_L1.Door01LeftIsOpen"; ///< bool RX Vehicle.Chassis.Door.Axle01.Left
|
static std::string dsLeftDoorIsOpen01 = "CAN_Input_L1.Door01LeftIsOpen"; ///< bool RX Vehicle.Chassis.Door.Axle01.Left
|
||||||
static std::string dsRightDoorIsOpen01 = "CAN_Input_R1.Door01RightIs"; ///< bool RX Vehicle.Chassis.Door.Axle01.Right
|
static std::string dsRightDoorIsOpen01 = "CAN_Input_R1.Door01RightIsOpen"; ///< bool RX Vehicle.Chassis.Door.Axle01.Right
|
||||||
static std::string dsLeftDoorIsOpen02 = "CAN_Input_L2.Door02LeftIsOpen"; ///< bool RX Vehicle.Chassis.Door.Axle02.Left
|
static std::string dsLeftDoorIsOpen02 = "CAN_Input_L2.Door02LeftIsOpen"; ///< bool RX Vehicle.Chassis.Door.Axle02.Left
|
||||||
static std::string dsRightDoorIsOpen02 = "CAN_Input_R2.Door02RightIsOpen"; ///< bool RX Vehicle.Chassis.Door.Axle02.Right
|
static std::string dsRightDoorIsOpen02 = "CAN_Input_R2.Door02RightIsOpen"; ///< bool RX Vehicle.Chassis.Door.Axle02.Right
|
||||||
static std::string dsLeftLatch01 = "CAN_Output.LockDoor01Left"; ///< bool TX Vehicle.Chassis.TX.Door.Axle01.Left
|
static std::string dsLeftLatch01 = "CAN_Output.LockDoor01Left"; ///< bool TX Vehicle.Chassis.TX.Door.Axle01.Left
|
||||||
static std::string dsRightLatch01 = "CAN_Output.LockDoor01Right"; ///< bool TX Vehicle.Chassis.TX.Door.Axle01.Right
|
static std::string dsRightLatch01 = "CAN_Output.LockDoor01Right"; ///< bool TX Vehicle.Chassis.TX.Door.Axle01.Right
|
||||||
static std::string dsLeftLatch02 = "CAN_Output.LockDoor02Left"; ///< bool TX Vehicle.Chassis.TX.Door.Axle02.Left
|
static std::string dsLeftLatch02 = "CAN_Output.LockDoor02Left"; ///< bool TX Vehicle.Chassis.TX.Door.Axle02.Left
|
||||||
static std::string dsRightLatch02 = "CAN_Output.LockDoor02Right"; ///< bool TX Vehicle.Chassis.TX.Door.Axle02.Right
|
static std::string dsRightLatch02 = "CAN_Output.LockDoor02Right"; ///< bool TX Vehicle.Chassis.TX.Door.Axle02.Left
|
||||||
|
|
||||||
} // doors
|
} // doors
|
||||||
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif // SIGNAL_NAMES_H
|
#endif // SIGNAL_NAMES_H
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
date 08/28/25 19:10:31
|
date 08/28/25 19:10:31
|
||||||
base hex timestamps absolute
|
base hex timestamps absolute
|
||||||
Begin Triggerblock 08/28/25 19:10:31
|
Begin TriggerBlock 08/28/25 19:10:31
|
||||||
0.000000 Start of measurement
|
0.000000 Start of measurement
|
||||||
0.021165 1 1 Rx d 1 02
|
0.021165 1 1 Rx d 1 02
|
||||||
0.031165 1 2 Rx d 1 08
|
0.031165 1 2 Rx d 1 08
|
||||||
|
|||||||
@@ -14,8 +14,8 @@ namespace Doors2ExampleFMU
|
|||||||
// Data Dispatch Service signal names to dbc variable names C-type RX/TX vss name space
|
// Data Dispatch Service signal names to dbc variable names C-type RX/TX vss name space
|
||||||
static std::string dsDoor01LeftIsOpen = "CAN_Input_L1.Door01LeftIsOpen";
|
static std::string dsDoor01LeftIsOpen = "CAN_Input_L1.Door01LeftIsOpen";
|
||||||
static std::string dsDoor01RightIsOpen = "CAN_Input_R1.Door01RightIsOpen";
|
static std::string dsDoor01RightIsOpen = "CAN_Input_R1.Door01RightIsOpen";
|
||||||
static std::string dsLockDoor01Right = "CAN_Output.LockDoor01Right";
|
|
||||||
static std::string dsLockDoor01Left = "CAN_Output.LockDoor01Left";
|
static std::string dsLockDoor01Left = "CAN_Output.LockDoor01Left";
|
||||||
|
static std::string dsLockDoor01Right = "CAN_Output.LockDoor01Right";
|
||||||
|
|
||||||
} // Doors2ExampleFMU
|
} // Doors2ExampleFMU
|
||||||
|
|
||||||
|
|||||||
@@ -16,10 +16,10 @@ namespace Doors4ExampleFMU
|
|||||||
static std::string dsDoor01RightIsOpen = "CAN_Input_R1.Door01RightIsOpen";
|
static std::string dsDoor01RightIsOpen = "CAN_Input_R1.Door01RightIsOpen";
|
||||||
static std::string dsDoor02LeftIsOpen = "CAN_Input_L2.Door02LeftIsOpen";
|
static std::string dsDoor02LeftIsOpen = "CAN_Input_L2.Door02LeftIsOpen";
|
||||||
static std::string dsDoor02RightIsOpen = "CAN_Input_R2.Door02RightIsOpen";
|
static std::string dsDoor02RightIsOpen = "CAN_Input_R2.Door02RightIsOpen";
|
||||||
static std::string dsLockDoor02Right = "CAN_Output.LockDoor02Right";
|
|
||||||
static std::string dsLockDoor02Left = "CAN_Output.LockDoor02Left";
|
|
||||||
static std::string dsLockDoor01Right = "CAN_Output.LockDoor01Right";
|
|
||||||
static std::string dsLockDoor01Left = "CAN_Output.LockDoor01Left";
|
static std::string dsLockDoor01Left = "CAN_Output.LockDoor01Left";
|
||||||
|
static std::string dsLockDoor01Right = "CAN_Output.LockDoor01Right";
|
||||||
|
static std::string dsLockDoor02Left = "CAN_Output.LockDoor02Left";
|
||||||
|
static std::string dsLockDoor02Right = "CAN_Output.LockDoor02Right";
|
||||||
|
|
||||||
} // Doors4ExampleFMU
|
} // Doors4ExampleFMU
|
||||||
|
|
||||||
|
|||||||
@@ -134,7 +134,7 @@ bool CConsole::PrepareDataConsumers()
|
|||||||
basicService->RegisterOnSignalChangeOfVehicleSpeed(dynamic_cast<vss::Vehicle::SpeedService::IVSS_SetSpeed_Event*> (this));
|
basicService->RegisterOnSignalChangeOfVehicleSpeed(dynamic_cast<vss::Vehicle::SpeedService::IVSS_SetSpeed_Event*> (this));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Request the basic service for opening the drunk.
|
// Request the basic service for opening the trunk.
|
||||||
m_pTrunkSvc = sdv::core::GetObject("Vehicle.Body.Trunk_Service").GetInterface<vss::Vehicle::Body::TrunkService::IVSS_SetOpen>();
|
m_pTrunkSvc = sdv::core::GetObject("Vehicle.Body.Trunk_Service").GetInterface<vss::Vehicle::Body::TrunkService::IVSS_SetOpen>();
|
||||||
if (m_pTrunkSvc)
|
if (m_pTrunkSvc)
|
||||||
PrintText(g_sComplexServcie1, "Basic Service available");
|
PrintText(g_sComplexServcie1, "Basic Service available");
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
date 08/28/25 19:10:31
|
date 08/28/25 19:10:31
|
||||||
base hex timestamps absolute
|
base hex timestamps absolute
|
||||||
Begin Triggerblock 08/28/25 19:10:31
|
Begin TriggerBlock 08/28/25 19:10:31
|
||||||
0.000000 Start of measurement
|
0.000000 Start of measurement
|
||||||
0.201165 1 0 Rx d 8 00 00 00 00 00 00 00 32
|
0.201165 1 0 Rx d 8 00 00 00 00 00 00 00 32
|
||||||
0.401499 1 0 Rx d 8 00 00 00 00 00 00 00 66
|
0.401499 1 0 Rx d 8 00 00 00 00 00 00 00 66
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
date 08/28/25 19:10:31
|
date 08/28/25 19:10:31
|
||||||
base hex timestamps absolute
|
base hex timestamps absolute
|
||||||
Begin Triggerblock 08/28/25 19:10:31
|
Begin TriggerBlock 08/28/25 19:10:31
|
||||||
0.000000 Start of measurement
|
0.000000 Start of measurement
|
||||||
0.201165 1 0 Rx d 8 00 00 00 00 00 CC 00 32
|
0.201165 1 0 Rx d 8 00 00 00 00 00 CC 00 32
|
||||||
0.401499 1 0 Rx d 8 00 00 00 00 01 98 00 66
|
0.401499 1 0 Rx d 8 00 00 00 00 01 98 00 66
|
||||||
|
|||||||
@@ -95,90 +95,68 @@ namespace sdv
|
|||||||
{
|
{
|
||||||
if (m_bInit) return; // Prevent trying to load again.
|
if (m_bInit) return; // Prevent trying to load again.
|
||||||
m_bInit = true;
|
m_bInit = true;
|
||||||
|
bool bRelocFileError = false;
|
||||||
|
std::string ssRelocFileInfo = "";
|
||||||
|
std::string ssEnvironmentInfo = "";
|
||||||
|
|
||||||
// Check for the executable directory
|
// Check for the executable directory
|
||||||
std::filesystem::path pathCoreLib;
|
std::filesystem::path pathCoreLib;
|
||||||
if (std::filesystem::exists(GetExecDirectory() / "core_services.sdv"))
|
if (std::filesystem::exists(GetExecDirectory() / "core_services.sdv"))
|
||||||
pathCoreLib = GetExecDirectory() / "core_services.sdv";
|
pathCoreLib = GetExecDirectory() / "core_services.sdv";
|
||||||
// Check for the local config file
|
|
||||||
if (pathCoreLib.empty() && std::filesystem::exists(GetExecDirectory() / "sdv_core_reloc.toml"))
|
|
||||||
{
|
|
||||||
std::ifstream fstream(GetExecDirectory() / "sdv_core_reloc.toml");
|
|
||||||
std::string ssLine;
|
|
||||||
while (std::getline(fstream, ssLine))
|
|
||||||
{
|
|
||||||
size_t nPos = 0;
|
|
||||||
auto fnSkipWhitespace = [&]() { while (std::isspace(ssLine[nPos])) nPos++; };
|
|
||||||
fnSkipWhitespace();
|
|
||||||
if (ssLine[nPos] == '#') continue; // Rest of the line is comments
|
|
||||||
if (ssLine.substr(nPos, 9) != "directory") continue; // not the keq of interest: skip line
|
|
||||||
nPos += 9;
|
|
||||||
fnSkipWhitespace();
|
|
||||||
if (ssLine[nPos] != '=')
|
|
||||||
{
|
|
||||||
std::cout << "Error in \"sdv_core_reloc.toml\": expecting assignment character '=' following"
|
|
||||||
" keyword 'directory'." << std::endl;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
nPos++;
|
|
||||||
fnSkipWhitespace();
|
|
||||||
if (ssLine[nPos] != '\"')
|
|
||||||
{
|
|
||||||
std::cout << "Error in \"sdv_core_reloc.toml\": expecting double quote character '\"' indicating"
|
|
||||||
" a string begin'." << std::endl;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
nPos++;
|
|
||||||
size_t nStart = nPos;
|
|
||||||
while (nPos < ssLine.length() && ssLine[nPos] != '\"')
|
|
||||||
{
|
|
||||||
// Check for escape character
|
|
||||||
if (ssLine[nPos] == '\\') nPos++;
|
|
||||||
|
|
||||||
// Skip character
|
if (pathCoreLib.empty())
|
||||||
nPos++;
|
|
||||||
}
|
|
||||||
if (nPos >= ssLine.length() || ssLine[nPos] != '\"')
|
|
||||||
{
|
{
|
||||||
std::cout << "Error in \"sdv_core_reloc.toml\": expecting double quote character '\"' indicating"
|
if (std::filesystem::exists(GetExecDirectory() / "sdv_core_reloc.toml"))
|
||||||
" a string end'." << std::endl;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
std::string ssDirectory = ssLine.substr(nStart, nPos - nStart);
|
|
||||||
while (ssDirectory.empty())
|
|
||||||
{
|
{
|
||||||
std::cout << "Error in \"sdv_core_reloc.toml\": expecting a valid value following the assignment"
|
// Check for the library in the relocation directory
|
||||||
" of the 'directory' key." << std::endl;
|
auto relocFolder = GetRelocationPath();
|
||||||
break;
|
if (!relocFolder.empty())
|
||||||
|
{
|
||||||
|
auto coreLibFolder = std::filesystem::path(relocFolder) / "core_services.sdv";
|
||||||
|
if (coreLibFolder.is_relative())
|
||||||
|
coreLibFolder = (GetExecDirectory() / coreLibFolder).lexically_normal();
|
||||||
|
|
||||||
|
if (std::filesystem::exists(coreLibFolder))
|
||||||
|
pathCoreLib = coreLibFolder;
|
||||||
}
|
}
|
||||||
pathCoreLib = std::filesystem::path(ssDirectory) / "core_services.sdv";
|
if (pathCoreLib.empty())
|
||||||
if (pathCoreLib.is_relative())
|
{
|
||||||
pathCoreLib = (GetExecDirectory() / pathCoreLib).lexically_normal();
|
bRelocFileError = true; // we found the file but not the core library, we must run into an error
|
||||||
break;
|
ssRelocFileInfo = "Error: Invalid \"sdv_core_reloc.toml\" file found (but no core library), it contains: " + relocFolder;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Check for the environment variable
|
}
|
||||||
|
|
||||||
|
if (pathCoreLib.empty())
|
||||||
|
{
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
std::wstring ssPathCoreTemp(32768, '\0');
|
std::wstring ssPathCoreTemp(32768, '\0');
|
||||||
GetEnvironmentVariable(L"SDV_FRAMEWORK_RUNTIME", ssPathCoreTemp.data(), static_cast<DWORD>(ssPathCoreTemp.size()));
|
GetEnvironmentVariable(L"SDV_FRAMEWORK_RUNTIME", ssPathCoreTemp.data(), static_cast<DWORD>(ssPathCoreTemp.size()));
|
||||||
ssPathCoreTemp.resize(wcsnlen(ssPathCoreTemp.c_str(), ssPathCoreTemp.size()));
|
ssPathCoreTemp.resize(wcsnlen(ssPathCoreTemp.c_str(), ssPathCoreTemp.size()));
|
||||||
if (pathCoreLib.empty() && !ssPathCoreTemp.empty())
|
if (!ssPathCoreTemp.empty())
|
||||||
{
|
{
|
||||||
pathCoreLib = std::filesystem::path(ssPathCoreTemp) / "core_services.sdv";
|
pathCoreLib = std::filesystem::path(ssPathCoreTemp) / "core_services.sdv";
|
||||||
#else
|
#else
|
||||||
if (pathCoreLib.empty() && getenv("SDV_FRAMEWORK_RUNTIME"))
|
std::string ssPathCoreTemp = std::getenv("SDV_FRAMEWORK_RUNTIME") ? std::getenv("SDV_FRAMEWORK_RUNTIME") : "";
|
||||||
|
if (!ssPathCoreTemp.empty())
|
||||||
{
|
{
|
||||||
pathCoreLib = std::filesystem::path(getenv("SDV_FRAMEWORK_RUNTIME")) / "core_services.sdv";
|
pathCoreLib = std::filesystem::path(ssPathCoreTemp) / "core_services.sdv";
|
||||||
#endif
|
#endif
|
||||||
if (pathCoreLib.is_relative())
|
if (pathCoreLib.is_relative())
|
||||||
pathCoreLib = (GetExecDirectory() / pathCoreLib).lexically_normal();
|
pathCoreLib = (GetExecDirectory() / pathCoreLib).lexically_normal();
|
||||||
|
|
||||||
|
if (!pathCoreLib.empty())
|
||||||
|
ssEnvironmentInfo = "System environment path: " + pathCoreLib.generic_string();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Depend on system path to find the library
|
// Depend on system path to find the library
|
||||||
if (pathCoreLib.empty())
|
if (pathCoreLib.empty())
|
||||||
pathCoreLib = "core_services.sdv";
|
pathCoreLib = "core_services.sdv";
|
||||||
|
|
||||||
// Open the library
|
// Open the library only if there is no or a valid 'sdv_core_reloc.toml' file
|
||||||
|
if (!bRelocFileError)
|
||||||
|
{
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
SetErrorMode(SEM_FAILCRITICALERRORS);
|
SetErrorMode(SEM_FAILCRITICALERRORS);
|
||||||
m_tModule = reinterpret_cast<core::TModuleID>(LoadLibraryW(pathCoreLib.native().c_str()));
|
m_tModule = reinterpret_cast<core::TModuleID>(LoadLibraryW(pathCoreLib.native().c_str()));
|
||||||
@@ -187,6 +165,8 @@ namespace sdv
|
|||||||
#else
|
#else
|
||||||
#error OS is not supported!
|
#error OS is not supported!
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
if (!m_tModule)
|
if (!m_tModule)
|
||||||
{
|
{
|
||||||
std::string ssError;
|
std::string ssError;
|
||||||
@@ -201,6 +181,13 @@ namespace sdv
|
|||||||
#else
|
#else
|
||||||
#error OS is not supported!
|
#error OS is not supported!
|
||||||
#endif
|
#endif
|
||||||
|
if (ssRelocFileInfo.empty() && ssEnvironmentInfo.empty())
|
||||||
|
std::cerr << "No environment variable set and no realocation file found." << std::endl;
|
||||||
|
if (!ssRelocFileInfo.empty())
|
||||||
|
std::cerr << ssRelocFileInfo << std::endl;
|
||||||
|
if (!ssEnvironmentInfo.empty())
|
||||||
|
std::cerr << ssEnvironmentInfo << std::endl;
|
||||||
|
|
||||||
std::cerr << "Could not load \"core_services.sdv\" library";
|
std::cerr << "Could not load \"core_services.sdv\" library";
|
||||||
if (!ssError.empty()) std::cerr << ": " << ssError;
|
if (!ssError.empty()) std::cerr << ": " << ssError;
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
@@ -264,6 +251,69 @@ namespace sdv
|
|||||||
return std::filesystem::path{ssPath.c_str()}.parent_path() / ""; // To finish the folder path with (back)slash
|
return std::filesystem::path{ssPath.c_str()}.parent_path() / ""; // To finish the folder path with (back)slash
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Get the folder path in the file 'sdv_core_reloc.toml'.
|
||||||
|
* @return Path content, empty string if not found.
|
||||||
|
*/
|
||||||
|
static std::string GetRelocationPath()
|
||||||
|
{
|
||||||
|
if (std::filesystem::exists(GetExecDirectory() / "sdv_core_reloc.toml"))
|
||||||
|
{
|
||||||
|
std::ifstream fstream(GetExecDirectory() / "sdv_core_reloc.toml");
|
||||||
|
std::string ssLine;
|
||||||
|
while (std::getline(fstream, ssLine))
|
||||||
|
{
|
||||||
|
size_t nPos = 0;
|
||||||
|
auto fnSkipWhitespace = [&]() { while (std::isspace(ssLine[nPos])) nPos++; };
|
||||||
|
fnSkipWhitespace();
|
||||||
|
if (ssLine[nPos] == '#') continue; // Rest of the line is comments
|
||||||
|
if (ssLine.substr(nPos, 9) != "directory") continue; // not the keq of interest: skip line
|
||||||
|
nPos += 9;
|
||||||
|
fnSkipWhitespace();
|
||||||
|
if (ssLine[nPos] != '=')
|
||||||
|
{
|
||||||
|
std::cout << "Error in \"sdv_core_reloc.toml\": expecting assignment character '=' following"
|
||||||
|
" keyword 'directory'." << std::endl;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
nPos++;
|
||||||
|
fnSkipWhitespace();
|
||||||
|
if (ssLine[nPos] != '\"')
|
||||||
|
{
|
||||||
|
std::cout << "Error in \"sdv_core_reloc.toml\": expecting double quote character '\"' indicating"
|
||||||
|
" a string begin'." << std::endl;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
nPos++;
|
||||||
|
size_t nStart = nPos;
|
||||||
|
while (nPos < ssLine.length() && ssLine[nPos] != '\"')
|
||||||
|
{
|
||||||
|
// Check for escape character
|
||||||
|
if (ssLine[nPos] == '\\') nPos++;
|
||||||
|
|
||||||
|
// Skip character
|
||||||
|
nPos++;
|
||||||
|
}
|
||||||
|
if (nPos >= ssLine.length() || ssLine[nPos] != '\"')
|
||||||
|
{
|
||||||
|
std::cout << "Error in \"sdv_core_reloc.toml\": expecting double quote character '\"' indicating"
|
||||||
|
" a string end'." << std::endl;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
std::string ssDirectory = ssLine.substr(nStart, nPos - nStart);
|
||||||
|
while (ssDirectory.empty())
|
||||||
|
{
|
||||||
|
std::cout << "Error in \"sdv_core_reloc.toml\": expecting a valid value following the assignment"
|
||||||
|
" of the 'directory' key." << std::endl;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ssDirectory;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
bool m_bInit = false; ///< Is the loader initialized?
|
bool m_bInit = false; ///< Is the loader initialized?
|
||||||
core::TModuleID m_tModule = 0; ///< Module ID
|
core::TModuleID m_tModule = 0; ///< Module ID
|
||||||
IInterfaceAccess* m_pCore = nullptr; ///< Pointer to the core services.
|
IInterfaceAccess* m_pCore = nullptr; ///< Pointer to the core services.
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ namespace asc
|
|||||||
switch (eState)
|
switch (eState)
|
||||||
{
|
{
|
||||||
case EState::header:
|
case EState::header:
|
||||||
if (ssLine.compare(0, 18, "Begin Triggerblock") == 0)
|
if (ssLine.compare(0, 18, "Begin TriggerBlock") == 0)
|
||||||
eState = EState::body;
|
eState = EState::body;
|
||||||
break;
|
break;
|
||||||
case EState::body:
|
case EState::body:
|
||||||
@@ -72,6 +72,11 @@ namespace asc
|
|||||||
return std::make_pair(*m_itCurrent, true);
|
return std::make_pair(*m_itCurrent, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint32_t CAscReader::GetMessageCount() const
|
||||||
|
{
|
||||||
|
return m_lstMessages.size();
|
||||||
|
}
|
||||||
|
|
||||||
uint32_t CAscReader::GetLoopCount() const
|
uint32_t CAscReader::GetLoopCount() const
|
||||||
{
|
{
|
||||||
return m_uiLoopCount;
|
return m_uiLoopCount;
|
||||||
|
|||||||
@@ -56,6 +56,12 @@ namespace asc
|
|||||||
*/
|
*/
|
||||||
std::pair<SCanMessage, bool> Get() const;
|
std::pair<SCanMessage, bool> Get() const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Get the number of messages in the asc file
|
||||||
|
* @return Number of messages which count be read from the asc file.
|
||||||
|
*/
|
||||||
|
uint32_t GetMessageCount() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Get the number of loops the data set was sent
|
* @brief Get the number of loops the data set was sent
|
||||||
* @return Number of loops the data set was sent including the current loop
|
* @return Number of loops the data set was sent including the current loop
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ namespace asc
|
|||||||
fstream << "base hex timestamps absolute" << std::endl;
|
fstream << "base hex timestamps absolute" << std::endl;
|
||||||
|
|
||||||
// Stream trigger block
|
// Stream trigger block
|
||||||
fstream << "Begin Triggerblock " << std::put_time(std::localtime(&tmSystemTime), "%c") << std::endl;
|
fstream << "Begin TriggerBlock " << std::put_time(std::localtime(&tmSystemTime), "%c") << std::endl;
|
||||||
fstream << " 0.000000 Start of measurement" << std::endl;
|
fstream << " 0.000000 Start of measurement" << std::endl;
|
||||||
for (const SCanMessage& rsSample : m_lstMessages)
|
for (const SCanMessage& rsSample : m_lstMessages)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -199,9 +199,6 @@ void CVSSBSGenerator::CreateBasicServiceFilesForTXSignal(const SSignalBSDefiniti
|
|||||||
}
|
}
|
||||||
codingTX.GetKeyWordMap(signal, signalVD, mapKeywords);
|
codingTX.GetKeyWordMap(signal, signalVD, mapKeywords);
|
||||||
|
|
||||||
mapKeywords["basic_service_h"] = pathBSHeader.filename().generic_u8string();
|
|
||||||
mapKeywords["basic_service_cpp"] = pathBSClass.filename().generic_u8string();
|
|
||||||
|
|
||||||
fstreamBSHeader << ReplaceKeywords(szTXBasicServiceHeaderTemplate, mapKeywords);
|
fstreamBSHeader << ReplaceKeywords(szTXBasicServiceHeaderTemplate, mapKeywords);
|
||||||
fstreamBSClass << ReplaceKeywords(szTXBasicServiceClassTemplate, mapKeywords);
|
fstreamBSClass << ReplaceKeywords(szTXBasicServiceClassTemplate, mapKeywords);
|
||||||
fstreamBSHeader.close();
|
fstreamBSHeader.close();
|
||||||
|
|||||||
@@ -237,9 +237,6 @@ void CVSSVDGenerator::CreateVehicleDeviceFilesForTXSignal(const SSignalVDDefinit
|
|||||||
CVSSVDCodingTX codingTX(m_ssPrefix);
|
CVSSVDCodingTX codingTX(m_ssPrefix);
|
||||||
codingTX.GetKeyWordMap(signal, mapKeywords);
|
codingTX.GetKeyWordMap(signal, mapKeywords);
|
||||||
|
|
||||||
mapKeywords["abstract_device_h"] = pathVDHeader.filename().generic_u8string();
|
|
||||||
mapKeywords["abstract_device_cpp"] = pathVDClass.filename().generic_u8string();
|
|
||||||
|
|
||||||
fstreamVDHeader << ReplaceKeywords(szTXVehicleDeviceHeaderTemplate, mapKeywords);
|
fstreamVDHeader << ReplaceKeywords(szTXVehicleDeviceHeaderTemplate, mapKeywords);
|
||||||
fstreamVDClass << ReplaceKeywords(szTXVehicleDeviceClassTemplate, mapKeywords);
|
fstreamVDClass << ReplaceKeywords(szTXVehicleDeviceClassTemplate, mapKeywords);
|
||||||
fstreamVDHeader.close();
|
fstreamVDHeader.close();
|
||||||
|
|||||||
@@ -72,6 +72,16 @@ void CCANSimulation::Initialize(const sdv::u8string& rssObjectConfig)
|
|||||||
m_eStatus = sdv::EObjectStatus::initialization_failure;
|
m_eStatus = sdv::EObjectStatus::initialization_failure;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (!m_pathSource.empty() && !m_reader.GetMessageCount())
|
||||||
|
{
|
||||||
|
SDV_LOG(sdv::core::ELogSeverity::error,
|
||||||
|
"No messages in ASC file '" + m_pathSource.generic_u8string() + "' found. File must contain 'Begin TriggerBlock' and 'End TriggerBlock' line.");
|
||||||
|
m_eStatus = sdv::EObjectStatus::initialization_failure;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!m_pathSource.empty())
|
||||||
|
SDV_LOG(sdv::core::ELogSeverity::info,
|
||||||
|
"CAN simulator ASC file '" + m_pathSource.generic_u8string() + "' contains ", m_reader.GetMessageCount(), " messages.");
|
||||||
|
|
||||||
// Update the status
|
// Update the status
|
||||||
m_eStatus = sdv::EObjectStatus::initialized;
|
m_eStatus = sdv::EObjectStatus::initialized;
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ date Wed Jul 28 06:47:19 pm 2010
|
|||||||
base hex timestamps absolute
|
base hex timestamps absolute
|
||||||
internal events logged
|
internal events logged
|
||||||
// version 7.0.1
|
// version 7.0.1
|
||||||
Begin Triggerblock Wed Jul 28 06:47:19 pm 2010
|
Begin TriggerBlock Wed Jul 28 06:47:19 pm 2010
|
||||||
0.000000 Start of measurement
|
0.000000 Start of measurement
|
||||||
0.005502 CAN 1 Status:chip status error active
|
0.005502 CAN 1 Status:chip status error active
|
||||||
0.005675 CAN 2 Status:chip status error active
|
0.005675 CAN 2 Status:chip status error active
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
date Dez. 3 2014 16:34:20
|
date Dez. 3 2014 16:34:20
|
||||||
base hex timestamps absolute
|
base hex timestamps absolute
|
||||||
no internal events logged
|
no internal events logged
|
||||||
Begin Triggerblock
|
Begin TriggerBlock
|
||||||
3.35516 1 B4323x Rx D 8 72 E4 19 2F 14 00 00 00
|
3.35516 1 B4323x Rx D 8 72 E4 19 2F 14 00 00 00
|
||||||
3.35522 6 52 Rx D 2 6C 60
|
3.35522 6 52 Rx D 2 6C 60
|
||||||
3.36716 1 B4323x Rx D 8 73 E5 E9 24 e2 00 00 00
|
3.36716 1 B4323x Rx D 8 73 E5 E9 24 e2 00 00 00
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ date Mon Mai 19 15:37:13.000 2014
|
|||||||
base hex timestamps absolute
|
base hex timestamps absolute
|
||||||
internal events logged
|
internal events logged
|
||||||
// version 8.5.0
|
// version 8.5.0
|
||||||
Begin Triggerblock Mon Mai 19 15:37:13.690 2014
|
Begin TriggerBlock Mon Mai 19 15:37:13.690 2014
|
||||||
0.590000 1 539 Rx d 1 03 Length 108000 BitCount = 58 ID = 1337
|
0.590000 1 539 Rx d 1 03 Length 108000 BitCount = 58 ID = 1337
|
||||||
0.619000 1 71x Rx d 1 42 Length 152000 BitCount = 80 ID = 113x
|
0.619000 1 71x Rx d 1 42 Length 152000 BitCount = 80 ID = 113x
|
||||||
0.690000 1 539 Rx d 1 04 Length 106000 BitCount = 57 ID = 1337
|
0.690000 1 539 Rx d 1 04 Length 106000 BitCount = 57 ID = 1337
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ date Wed Jul 28 06:47:19 pm 2010
|
|||||||
base hex timestamps absolute
|
base hex timestamps absolute
|
||||||
internal events logged
|
internal events logged
|
||||||
// version 7.0.1
|
// version 7.0.1
|
||||||
Begin Triggerblock Wed Jul 28 06:47:19 pm 2010
|
Begin TriggerBlock Wed Jul 28 06:47:19 pm 2010
|
||||||
0.000000 Start of measurement
|
0.000000 Start of measurement
|
||||||
0.005502 CAN 1 Status:chip status error active
|
0.005502 CAN 1 Status:chip status error active
|
||||||
0.005675 CAN 2 Status:chip status error active
|
0.005675 CAN 2 Status:chip status error active
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ date Wed Jul 28 06:47:19 pm 2010
|
|||||||
base hex timestamps absolute
|
base hex timestamps absolute
|
||||||
internal events logged
|
internal events logged
|
||||||
// version 7.0.1
|
// version 7.0.1
|
||||||
Begin Triggerblock Wed Jul 28 06:47:19 pm 2010
|
Begin TriggerBlock Wed Jul 28 06:47:19 pm 2010
|
||||||
0.000000 Start of measurement
|
0.000000 Start of measurement
|
||||||
0.005502 CAN 1 Status:chip status error active
|
0.005502 CAN 1 Status:chip status error active
|
||||||
0.005675 CAN 2 Status:chip status error active
|
0.005675 CAN 2 Status:chip status error active
|
||||||
|
|||||||
Reference in New Issue
Block a user