Initial check-in

This commit is contained in:
Duc
2025-03-13 18:34:37 -07:00
parent ce54c97eb1
commit d12862a54e
40 changed files with 5241 additions and 20 deletions

View File

@@ -0,0 +1,31 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.33920.266
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "HWIL_Client", "HWIL_Client\HWIL_Client.vcxproj", "{293D7BAA-6442-4DC6-8B0F-73E104F34016}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{293D7BAA-6442-4DC6-8B0F-73E104F34016}.Debug|x64.ActiveCfg = Debug|x64
{293D7BAA-6442-4DC6-8B0F-73E104F34016}.Debug|x64.Build.0 = Debug|x64
{293D7BAA-6442-4DC6-8B0F-73E104F34016}.Debug|x86.ActiveCfg = Debug|Win32
{293D7BAA-6442-4DC6-8B0F-73E104F34016}.Debug|x86.Build.0 = Debug|Win32
{293D7BAA-6442-4DC6-8B0F-73E104F34016}.Release|x64.ActiveCfg = Release|x64
{293D7BAA-6442-4DC6-8B0F-73E104F34016}.Release|x64.Build.0 = Release|x64
{293D7BAA-6442-4DC6-8B0F-73E104F34016}.Release|x86.ActiveCfg = Release|Win32
{293D7BAA-6442-4DC6-8B0F-73E104F34016}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {F3E678A4-BA50-4E7F-AEAE-4013D9A3359E}
EndGlobalSection
EndGlobal

View File

@@ -0,0 +1,269 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<VCProjectVersion>16.0</VCProjectVersion>
<Keyword>Win32Proj</Keyword>
<ProjectGuid>{293d7baa-6442-4dc6-8b0f-73e104f34016}</ProjectGuid>
<RootNamespace>HWILClient</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
<OutDir>$(ProjectDir)_$(PlatformShortName)\$(Configuration)\bin\</OutDir>
<IntDir>$(ProjectDir)_$(PlatformShortName)\$(Configuration)\obj\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
<OutDir>$(ProjectDir)_$(PlatformShortName)\$(Configuration)\bin\</OutDir>
<IntDir>$(ProjectDir)_$(PlatformShortName)\$(Configuration)\obj\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental>
<OutDir>$(ProjectDir)_$(PlatformShortName)\$(Configuration)\bin\</OutDir>
<IntDir>$(ProjectDir)_$(PlatformShortName)\$(Configuration)\obj\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
<OutDir>$(ProjectDir)_$(PlatformShortName)\$(Configuration)\bin\</OutDir>
<IntDir>$(ProjectDir)_$(PlatformShortName)\$(Configuration)\obj\</IntDir>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<AdditionalIncludeDirectories>.\source;.\source\Common;.\source\CommonLib\Comm;.\source\CommonLib\Exceptions;.\source\CommonLib\Lib;.\source\CommonLib\Lib\Util;.\source\CommonLib\Names;.\source\CommonLib\Proc;.\source\AutomationMessages</AdditionalIncludeDirectories>
<AdditionalOptions>/MP /D "__FUNCTION_NAME__=__FUNCTION__\"()\"" %(AdditionalOptions)</AdditionalOptions>
<DisableSpecificWarnings>26812</DisableSpecificWarnings>
<LanguageStandard>stdcpp17</LanguageStandard>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>Rpcrt4.lib;Shlwapi.lib;iphlpapi.lib;ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
<PostBuildEvent>
<Command>xcopy /y ".\config\config.ini" "$(OutDir)"</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<AdditionalIncludeDirectories>.\source;.\source\Common;.\source\CommonLib\Comm;.\source\CommonLib\Exceptions;.\source\CommonLib\Lib;.\source\CommonLib\Lib\Util;.\source\CommonLib\Names;.\source\CommonLib\Proc;.\source\AutomationMessages</AdditionalIncludeDirectories>
<AdditionalOptions>/MP /D "__FUNCTION_NAME__=__FUNCTION__\"()\"" %(AdditionalOptions)</AdditionalOptions>
<DisableSpecificWarnings>26812</DisableSpecificWarnings>
<LanguageStandard>stdcpp17</LanguageStandard>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>Rpcrt4.lib;Shlwapi.lib;iphlpapi.lib;ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
<PostBuildEvent>
<Command>xcopy /y ".\config\config.ini" "$(OutDir)"</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<AdditionalIncludeDirectories>.\source;.\source\Common;.\source\CommonLib\Comm;.\source\CommonLib\Exceptions;.\source\CommonLib\Lib;.\source\CommonLib\Lib\Util;.\source\CommonLib\Names;.\source\CommonLib\Proc;.\source\AutomationMessages</AdditionalIncludeDirectories>
<AdditionalOptions>/MP /D "__FUNCTION_NAME__=__FUNCTION__\"()\"" %(AdditionalOptions)</AdditionalOptions>
<DisableSpecificWarnings>26812;4267</DisableSpecificWarnings>
<LanguageStandard>stdcpp17</LanguageStandard>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>Rpcrt4.lib;Shlwapi.lib;iphlpapi.lib;ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
<PostBuildEvent>
<Command>xcopy /y ".\config\config.ini" "$(OutDir)"</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<LanguageStandard>stdcpp17</LanguageStandard>
<AdditionalIncludeDirectories>.\source;.\source\Common;.\source\CommonLib\Comm;.\source\CommonLib\Exceptions;.\source\CommonLib\Lib;.\source\CommonLib\Lib\Util;.\source\CommonLib\Names;.\source\CommonLib\Proc;.\source\AutomationMessages</AdditionalIncludeDirectories>
<AdditionalOptions>/MP /D "__FUNCTION_NAME__=__FUNCTION__\"()\"" %(AdditionalOptions)</AdditionalOptions>
<DisableSpecificWarnings>4267</DisableSpecificWarnings>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>Rpcrt4.lib;Shlwapi.lib;iphlpapi.lib;ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
<PostBuildEvent>
<Command>xcopy /y ".\config\config.ini" "$(OutDir)"</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="main.cpp" />
<ClCompile Include="source\AutomationMessages\AutomationMsgHandler.cpp" />
<ClCompile Include="source\AutomationMessages\AutomationMsgParser.cpp" />
<ClCompile Include="source\AutomationMessages\GenericRspMessage.cpp" />
<ClCompile Include="source\AutomationMessages\KwScenarioStarted.cpp" />
<ClCompile Include="source\AutomationMessages\KwScenarioStopped.cpp" />
<ClCompile Include="source\AutomationMessages\Message.cpp" />
<ClCompile Include="source\AutomationMessages\MessageHeader.cpp" />
<ClCompile Include="source\AutomationMessages\MoveGutsVideosToSubFolderCmdMessage.cpp" />
<ClCompile Include="source\AutomationMessages\TransferAFileCmdMessage.cpp" />
<ClCompile Include="source\AutomationMessages\TransferGutsVideosCmdMessage.cpp" />
<ClCompile Include="source\AutomationMessages\WaitForLastTaskCompletionCmdMessage.cpp" />
<ClCompile Include="source\CommonLib\Comm\Socket.cpp" />
<ClCompile Include="source\CommonLib\Comm\TCPSocket.cpp" />
<ClCompile Include="source\CommonLib\Comm\UdpSocket.cpp" />
<ClCompile Include="source\CommonLib\Exceptions\Exception.cpp" />
<ClCompile Include="source\CommonLib\Exceptions\TimeoutError.cpp" />
<ClCompile Include="source\CommonLib\Lib\CRC32.cpp" />
<ClCompile Include="source\CommonLib\Lib\ErrorLog.cpp" />
<ClCompile Include="source\CommonLib\Lib\IniFile.cpp" />
<ClCompile Include="source\CommonLib\Lib\LockMutex.cpp" />
<ClCompile Include="source\CommonLib\Lib\NTEvent.cpp" />
<ClCompile Include="source\CommonLib\Lib\NTMutex.cpp" />
<ClCompile Include="source\CommonLib\Lib\NTSemaphore.cpp" />
<ClCompile Include="source\CommonLib\Lib\OSObject.cpp" />
<ClCompile Include="source\CommonLib\Lib\Thread.cpp" />
<ClCompile Include="source\CommonLib\Lib\Timestamp.cpp" />
<ClCompile Include="source\CommonLib\Lib\Util\FileSystemUtil.cpp" />
<ClCompile Include="source\CommonLib\Lib\Util\MiscUtil.cpp" />
<ClCompile Include="source\CommonLib\Lib\Util\NetworkUtil.cpp" />
<ClCompile Include="source\CommonLib\Lib\Util\StringUtil.cpp" />
<ClCompile Include="source\CommonLib\Names\MailboxNames.cpp" />
<ClCompile Include="source\CommonLib\Names\SemaphoreNames.cpp" />
<ClCompile Include="source\CommonLib\Names\ThreadNames.cpp" />
<ClCompile Include="source\CommonLib\Proc\Proc.cpp" />
<ClCompile Include="source\Common\Constants.cpp" />
<ClCompile Include="source\Common\EventNames.cpp" />
<ClCompile Include="source\HwilClient.cpp" />
<ClCompile Include="source\HwilUdpSocket.cpp" />
<ClCompile Include="source\WinProc.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="source\AutomationMessages\AutomationMsgHandler.hpp" />
<ClInclude Include="source\AutomationMessages\AutomationMsgParser.hpp" />
<ClInclude Include="source\AutomationMessages\GenericRspMessage.hpp" />
<ClInclude Include="source\AutomationMessages\KwScenarioStarted.hpp" />
<ClInclude Include="source\AutomationMessages\KwScenarioStopped.hpp" />
<ClInclude Include="source\AutomationMessages\Message.hpp" />
<ClInclude Include="source\AutomationMessages\MessageHeader.hpp" />
<ClInclude Include="source\AutomationMessages\MessageIDs.hpp" />
<ClInclude Include="source\AutomationMessages\MoveGutsVideosToSubFolderCmdMessage.hpp" />
<ClInclude Include="source\AutomationMessages\TransferAFileCmdMessage.hpp" />
<ClInclude Include="source\AutomationMessages\TransferGutsVideosCmdMessage.hpp" />
<ClInclude Include="source\AutomationMessages\WaitForLastTaskCompletionCmdMessage.hpp" />
<ClInclude Include="source\CommonLib\Comm\Socket.hpp" />
<ClInclude Include="source\CommonLib\Comm\TCPSocket.hpp" />
<ClInclude Include="source\CommonLib\Comm\UdpSocket.hpp" />
<ClInclude Include="source\CommonLib\Exceptions\Exception.hpp" />
<ClInclude Include="source\CommonLib\Exceptions\TimeoutError.hpp" />
<ClInclude Include="source\CommonLib\Lib\CRC32.h" />
<ClInclude Include="source\CommonLib\Lib\CustomDataTypes.hpp" />
<ClInclude Include="source\CommonLib\Lib\ErrorLog.hpp" />
<ClInclude Include="source\CommonLib\Lib\IniFile.hpp" />
<ClInclude Include="source\CommonLib\Lib\LockMutex.hpp" />
<ClInclude Include="source\CommonLib\Lib\NTEvent.hpp" />
<ClInclude Include="source\CommonLib\Lib\NTMutex.hpp" />
<ClInclude Include="source\CommonLib\Lib\NTSemaphore.hpp" />
<ClInclude Include="source\CommonLib\Lib\OSObject.hpp" />
<ClInclude Include="source\CommonLib\Lib\Thread.hpp" />
<ClInclude Include="source\CommonLib\Lib\Timestamp.hpp" />
<ClInclude Include="source\CommonLib\Lib\Util\FileSystemUtil.hpp" />
<ClInclude Include="source\CommonLib\Lib\Util\MiscUtil.hpp" />
<ClInclude Include="source\CommonLib\Lib\Util\NetworkUtil.hpp" />
<ClInclude Include="source\CommonLib\Lib\Util\StringUtil.hpp" />
<ClInclude Include="source\CommonLib\Names\MailboxNames.hpp" />
<ClInclude Include="source\CommonLib\Names\SemaphoreNames.hpp" />
<ClInclude Include="source\CommonLib\Names\ThreadNames.hpp" />
<ClInclude Include="source\CommonLib\Proc\Proc.hpp" />
<ClInclude Include="source\Common\Constants.hpp" />
<ClInclude Include="source\Common\EventNames.hpp" />
<ClInclude Include="source\HwilClient.hpp" />
<ClInclude Include="source\HwilUdpSocket.hpp" />
<ClInclude Include="source\WinProc.hpp" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@@ -0,0 +1,291 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
<Filter Include="Source Files\AutomationMessages">
<UniqueIdentifier>{453543d1-d1eb-49c5-b0e6-7d577b07e6e1}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files\CommonLib">
<UniqueIdentifier>{6950984b-9c13-462d-9b30-4c817645ca55}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files\CommonLib\Comm">
<UniqueIdentifier>{507ef9ec-cf39-41db-8640-49109d898fdb}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files\CommonLib\Exceptions">
<UniqueIdentifier>{82458dd4-3d67-40d4-8656-e131dd43dfca}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files\CommonLib\Lib">
<UniqueIdentifier>{19de6a93-a84e-4df9-a0fc-d49a027e37f1}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files\CommonLib\Names">
<UniqueIdentifier>{16e2c28c-7a4f-4f42-8039-db2e955e3749}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files\CommonLib\Proc">
<UniqueIdentifier>{1959741c-94d2-46a5-94a8-f681b8a9b776}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files\CommonLib\Lib\Util">
<UniqueIdentifier>{67b12f82-e19f-4772-9173-422182604f37}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files\Common">
<UniqueIdentifier>{797b46a9-7c3f-4695-bb5d-4326e10b7dfb}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="main.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="source\HwilClient.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="source\HwilUdpSocket.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="source\AutomationMessages\AutomationMsgHandler.cpp">
<Filter>Source Files\AutomationMessages</Filter>
</ClCompile>
<ClCompile Include="source\AutomationMessages\AutomationMsgParser.cpp">
<Filter>Source Files\AutomationMessages</Filter>
</ClCompile>
<ClCompile Include="source\AutomationMessages\GenericRspMessage.cpp">
<Filter>Source Files\AutomationMessages</Filter>
</ClCompile>
<ClCompile Include="source\AutomationMessages\Message.cpp">
<Filter>Source Files\AutomationMessages</Filter>
</ClCompile>
<ClCompile Include="source\AutomationMessages\MessageHeader.cpp">
<Filter>Source Files\AutomationMessages</Filter>
</ClCompile>
<ClCompile Include="source\AutomationMessages\MoveGutsVideosToSubFolderCmdMessage.cpp">
<Filter>Source Files\AutomationMessages</Filter>
</ClCompile>
<ClCompile Include="source\AutomationMessages\TransferAFileCmdMessage.cpp">
<Filter>Source Files\AutomationMessages</Filter>
</ClCompile>
<ClCompile Include="source\AutomationMessages\TransferGutsVideosCmdMessage.cpp">
<Filter>Source Files\AutomationMessages</Filter>
</ClCompile>
<ClCompile Include="source\AutomationMessages\WaitForLastTaskCompletionCmdMessage.cpp">
<Filter>Source Files\AutomationMessages</Filter>
</ClCompile>
<ClCompile Include="source\AutomationMessages\KwScenarioStarted.cpp">
<Filter>Source Files\AutomationMessages</Filter>
</ClCompile>
<ClCompile Include="source\AutomationMessages\KwScenarioStopped.cpp">
<Filter>Source Files\AutomationMessages</Filter>
</ClCompile>
<ClCompile Include="source\CommonLib\Comm\UdpSocket.cpp">
<Filter>Source Files\CommonLib\Comm</Filter>
</ClCompile>
<ClCompile Include="source\CommonLib\Exceptions\Exception.cpp">
<Filter>Source Files\CommonLib\Exceptions</Filter>
</ClCompile>
<ClCompile Include="source\CommonLib\Exceptions\TimeoutError.cpp">
<Filter>Source Files\CommonLib\Exceptions</Filter>
</ClCompile>
<ClCompile Include="source\CommonLib\Lib\CRC32.cpp">
<Filter>Source Files\CommonLib\Lib</Filter>
</ClCompile>
<ClCompile Include="source\CommonLib\Lib\ErrorLog.cpp">
<Filter>Source Files\CommonLib\Lib</Filter>
</ClCompile>
<ClCompile Include="source\CommonLib\Lib\IniFile.cpp">
<Filter>Source Files\CommonLib\Lib</Filter>
</ClCompile>
<ClCompile Include="source\CommonLib\Lib\LockMutex.cpp">
<Filter>Source Files\CommonLib\Lib</Filter>
</ClCompile>
<ClCompile Include="source\CommonLib\Lib\NTEvent.cpp">
<Filter>Source Files\CommonLib\Lib</Filter>
</ClCompile>
<ClCompile Include="source\CommonLib\Lib\NTMutex.cpp">
<Filter>Source Files\CommonLib\Lib</Filter>
</ClCompile>
<ClCompile Include="source\CommonLib\Lib\NTSemaphore.cpp">
<Filter>Source Files\CommonLib\Lib</Filter>
</ClCompile>
<ClCompile Include="source\CommonLib\Lib\OSObject.cpp">
<Filter>Source Files\CommonLib\Lib</Filter>
</ClCompile>
<ClCompile Include="source\CommonLib\Lib\Thread.cpp">
<Filter>Source Files\CommonLib\Lib</Filter>
</ClCompile>
<ClCompile Include="source\CommonLib\Lib\Timestamp.cpp">
<Filter>Source Files\CommonLib\Lib</Filter>
</ClCompile>
<ClCompile Include="source\CommonLib\Lib\Util\FileSystemUtil.cpp">
<Filter>Source Files\CommonLib\Lib\Util</Filter>
</ClCompile>
<ClCompile Include="source\CommonLib\Lib\Util\MiscUtil.cpp">
<Filter>Source Files\CommonLib\Lib\Util</Filter>
</ClCompile>
<ClCompile Include="source\CommonLib\Lib\Util\NetworkUtil.cpp">
<Filter>Source Files\CommonLib\Lib\Util</Filter>
</ClCompile>
<ClCompile Include="source\CommonLib\Lib\Util\StringUtil.cpp">
<Filter>Source Files\CommonLib\Lib\Util</Filter>
</ClCompile>
<ClCompile Include="source\CommonLib\Names\MailboxNames.cpp">
<Filter>Source Files\CommonLib\Names</Filter>
</ClCompile>
<ClCompile Include="source\CommonLib\Names\SemaphoreNames.cpp">
<Filter>Source Files\CommonLib\Names</Filter>
</ClCompile>
<ClCompile Include="source\CommonLib\Names\ThreadNames.cpp">
<Filter>Source Files\CommonLib\Names</Filter>
</ClCompile>
<ClCompile Include="source\CommonLib\Proc\Proc.cpp">
<Filter>Source Files\CommonLib\Proc</Filter>
</ClCompile>
<ClCompile Include="source\WinProc.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="source\Common\Constants.cpp">
<Filter>Source Files\Common</Filter>
</ClCompile>
<ClCompile Include="source\Common\EventNames.cpp">
<Filter>Source Files\Common</Filter>
</ClCompile>
<ClCompile Include="source\CommonLib\Comm\Socket.cpp">
<Filter>Source Files\CommonLib\Comm</Filter>
</ClCompile>
<ClCompile Include="source\CommonLib\Comm\TCPSocket.cpp">
<Filter>Source Files\CommonLib\Comm</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="source\HwilClient.hpp">
<Filter>Source Files</Filter>
</ClInclude>
<ClInclude Include="source\HwilUdpSocket.hpp">
<Filter>Source Files</Filter>
</ClInclude>
<ClInclude Include="source\AutomationMessages\AutomationMsgHandler.hpp">
<Filter>Source Files\AutomationMessages</Filter>
</ClInclude>
<ClInclude Include="source\AutomationMessages\AutomationMsgParser.hpp">
<Filter>Source Files\AutomationMessages</Filter>
</ClInclude>
<ClInclude Include="source\AutomationMessages\GenericRspMessage.hpp">
<Filter>Source Files\AutomationMessages</Filter>
</ClInclude>
<ClInclude Include="source\AutomationMessages\Message.hpp">
<Filter>Source Files\AutomationMessages</Filter>
</ClInclude>
<ClInclude Include="source\AutomationMessages\MessageHeader.hpp">
<Filter>Source Files\AutomationMessages</Filter>
</ClInclude>
<ClInclude Include="source\AutomationMessages\MessageIDs.hpp">
<Filter>Source Files\AutomationMessages</Filter>
</ClInclude>
<ClInclude Include="source\AutomationMessages\MoveGutsVideosToSubFolderCmdMessage.hpp">
<Filter>Source Files\AutomationMessages</Filter>
</ClInclude>
<ClInclude Include="source\AutomationMessages\TransferAFileCmdMessage.hpp">
<Filter>Source Files\AutomationMessages</Filter>
</ClInclude>
<ClInclude Include="source\AutomationMessages\TransferGutsVideosCmdMessage.hpp">
<Filter>Source Files\AutomationMessages</Filter>
</ClInclude>
<ClInclude Include="source\AutomationMessages\WaitForLastTaskCompletionCmdMessage.hpp">
<Filter>Source Files\AutomationMessages</Filter>
</ClInclude>
<ClInclude Include="source\AutomationMessages\KwScenarioStarted.hpp">
<Filter>Source Files\AutomationMessages</Filter>
</ClInclude>
<ClInclude Include="source\AutomationMessages\KwScenarioStopped.hpp">
<Filter>Source Files\AutomationMessages</Filter>
</ClInclude>
<ClInclude Include="source\CommonLib\Comm\UdpSocket.hpp">
<Filter>Source Files\CommonLib\Comm</Filter>
</ClInclude>
<ClInclude Include="source\CommonLib\Exceptions\Exception.hpp">
<Filter>Source Files\CommonLib\Exceptions</Filter>
</ClInclude>
<ClInclude Include="source\CommonLib\Exceptions\TimeoutError.hpp">
<Filter>Source Files\CommonLib\Exceptions</Filter>
</ClInclude>
<ClInclude Include="source\CommonLib\Lib\CRC32.h">
<Filter>Source Files\CommonLib\Lib</Filter>
</ClInclude>
<ClInclude Include="source\CommonLib\Lib\CustomDataTypes.hpp">
<Filter>Source Files\CommonLib\Lib</Filter>
</ClInclude>
<ClInclude Include="source\CommonLib\Lib\ErrorLog.hpp">
<Filter>Source Files\CommonLib\Lib</Filter>
</ClInclude>
<ClInclude Include="source\CommonLib\Lib\IniFile.hpp">
<Filter>Source Files\CommonLib\Lib</Filter>
</ClInclude>
<ClInclude Include="source\CommonLib\Lib\LockMutex.hpp">
<Filter>Source Files\CommonLib\Lib</Filter>
</ClInclude>
<ClInclude Include="source\CommonLib\Lib\NTEvent.hpp">
<Filter>Source Files\CommonLib\Lib</Filter>
</ClInclude>
<ClInclude Include="source\CommonLib\Lib\NTMutex.hpp">
<Filter>Source Files\CommonLib\Lib</Filter>
</ClInclude>
<ClInclude Include="source\CommonLib\Lib\NTSemaphore.hpp">
<Filter>Source Files\CommonLib\Lib</Filter>
</ClInclude>
<ClInclude Include="source\CommonLib\Lib\OSObject.hpp">
<Filter>Source Files\CommonLib\Lib</Filter>
</ClInclude>
<ClInclude Include="source\CommonLib\Lib\Thread.hpp">
<Filter>Source Files\CommonLib\Lib</Filter>
</ClInclude>
<ClInclude Include="source\CommonLib\Lib\Timestamp.hpp">
<Filter>Source Files\CommonLib\Lib</Filter>
</ClInclude>
<ClInclude Include="source\CommonLib\Lib\Util\FileSystemUtil.hpp">
<Filter>Source Files\CommonLib\Lib\Util</Filter>
</ClInclude>
<ClInclude Include="source\CommonLib\Lib\Util\MiscUtil.hpp">
<Filter>Source Files\CommonLib\Lib\Util</Filter>
</ClInclude>
<ClInclude Include="source\CommonLib\Lib\Util\NetworkUtil.hpp">
<Filter>Source Files\CommonLib\Lib\Util</Filter>
</ClInclude>
<ClInclude Include="source\CommonLib\Lib\Util\StringUtil.hpp">
<Filter>Source Files\CommonLib\Lib\Util</Filter>
</ClInclude>
<ClInclude Include="source\CommonLib\Names\MailboxNames.hpp">
<Filter>Source Files\CommonLib\Names</Filter>
</ClInclude>
<ClInclude Include="source\CommonLib\Names\SemaphoreNames.hpp">
<Filter>Source Files\CommonLib\Names</Filter>
</ClInclude>
<ClInclude Include="source\CommonLib\Names\ThreadNames.hpp">
<Filter>Source Files\CommonLib\Names</Filter>
</ClInclude>
<ClInclude Include="source\CommonLib\Proc\Proc.hpp">
<Filter>Source Files\CommonLib\Proc</Filter>
</ClInclude>
<ClInclude Include="source\WinProc.hpp">
<Filter>Source Files</Filter>
</ClInclude>
<ClInclude Include="source\Common\Constants.hpp">
<Filter>Source Files\Common</Filter>
</ClInclude>
<ClInclude Include="source\Common\EventNames.hpp">
<Filter>Source Files\Common</Filter>
</ClInclude>
<ClInclude Include="source\CommonLib\Comm\Socket.hpp">
<Filter>Source Files\CommonLib\Comm</Filter>
</ClInclude>
<ClInclude Include="source\CommonLib\Comm\TCPSocket.hpp">
<Filter>Source Files\CommonLib\Comm</Filter>
</ClInclude>
</ItemGroup>
</Project>

View File

@@ -0,0 +1,37 @@
[GENERAL]
;ETB_REGEX_PATTERN = gucc.+
ETB_REGEX_PATTERN = rmdu.+
HWIL_UDP_REMOTE_PORT = 44454
HWIL_UDP_LOCAL_PORT = 44455
BASE_TEST_DATA_PATH = \\rrfs\projs\tsdc8\10911\DLe\test\
[SWDEV_PC]
;GUCC_COMPUTER = GUCC-SWDEV
GUCC_COMPUTER = rmdu0010260
KWCC3_COMPUTER = KWCC3-SWDEV
[SIXDOF_PC]
GUCC_COMPUTER = GUCC-6DOF
;GUCC_COMPUTER = asus-i7-6700k
KWCC3_COMPUTER = KWCC3-6DOF
[VIDEO_PC]
GUCC_COMPUTER = GUCC-VCS
KWCC3-COMPUTER = TUTRKWCC-VCS
UDP_REMOTE_PORT = 44452
UDP_LOCAL_PORT = 44453
NUM_FRAMES_TO_GRAB = 3500
[ASG_PC]
GUCC_EXEC_COMPUTER = NEXEC3
KWCC3_EXEC_COMPUTER = NEXEC2
GUCC_OGENA_COMPUTER = NOGEN3A
KWCC3_OGENA_COMPUTER = NOGEN2A
KWCC3_OGENB_COMPUTER = NOGEN2B
KWCC3_OGENC_COMPUTER = NOGEN2C

View File

@@ -0,0 +1,27 @@
#include <iostream>
#include <string>
#include "HwilClient.hpp"
#include "TimeoutError.hpp"
int main()
{
try
{
//while (1)
// HwilClient::instance()->startingScenario(Constants::RemoteHosts::SWDEV_PC);
while (1)
HwilClient::instance()->endingScenario(Constants::RemoteHosts::SWDEV_PC);
}
catch (Exception& e)
{
std::cout << e.getMessage() << std::endl;
}
std::cout << "Press any key to quit: ";
std::string str;
std::cin >> str;
return 0;
}

View File

@@ -0,0 +1,118 @@
// UNCLASSIFIED
/*-------------------------------------------------------------------------
RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION
PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS
AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO
UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO
RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS
CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS
OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON
COMPANY.
THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S.
GOVERNMENT.
UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
-------------------------------------------------------------------------*/
#include <cerrno>
#include <cstdio>
#include <string.h>
#include <string>
#include <sstream>
#include "AutomationMsgHandler.hpp"
#include "Exception.hpp"
#include "MessageHeader.hpp"
#include "MessageIDs.hpp"
#include "StringUtil.hpp"
#include "TransferGutsVideosCmdMessage.hpp"
#include "TransferAFileCmdMessage.hpp"
//-----------------------------------------------------------------------------
AutomationMsgHandler::AutomationMsgHandler()
{
}
//-----------------------------------------------------------------------------
AutomationMsgHandler::~AutomationMsgHandler(){}
//-----------------------------------------------------------------------------
AutomationMsgHandler& AutomationMsgHandler::instance()
{
static AutomationMsgHandler handler;
return handler;
}
//-----------------------------------------------------------------------------
void AutomationMsgHandler::handleMsg(const unsigned char* pData, const unsigned int& id)
{
bool selfThrown = false;
try
{
MessageIDs::MsgIds msgId = (MessageIDs::MsgIds)id;
if (msgId == MessageIDs::SCENARIO_STARTED_CMD)
{
HandleKwScenarioStartedMessage(pData);
}
else if (msgId == MessageIDs::SCENARIO_STOPPED_CMD)
{
HandleKwScenarioStoppedMessage(pData);
}
else
{
std::stringstream ss;
ss << "unknown message id: " << id;
selfThrown = true;
throw Exception (__FUNCTION_NAME__, ss.str());
}
}
catch (Exception& e)
{
if (!selfThrown)
e.buildStackTrace(__FUNCTION_NAME__);
throw e;
}
}
//-----------------------------------------------------------------------------
void AutomationMsgHandler::HandleKwScenarioStartedMessage(const unsigned char* pData)
{
bool selfThrown = false;
try {
}
catch (Exception& e)
{
if (!selfThrown)
e.buildStackTrace(__FUNCTION_NAME__);
throw e;
}
}
//-----------------------------------------------------------------------------
void AutomationMsgHandler::HandleKwScenarioStoppedMessage(const unsigned char* pData)
{
bool selfThrown = false;
try {
}
catch (Exception& e)
{
if (!selfThrown)
e.buildStackTrace(__FUNCTION_NAME__);
throw e;
}
}

View File

@@ -0,0 +1,92 @@
// UNCLASSIFIED
/*-------------------------------------------------------------------------
RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION
PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS
AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO
UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO
RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS
CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS
OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON
COMPANY.
THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S.
GOVERNMENT.
UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
-------------------------------------------------------------------------*/
#pragma once
#include "MessageIDs.hpp"
#include <vector>
class AutomationMsgHandler
{
public:
//>---------------------------------------------------------------------------
// Function: instance
//
// Purpose: singleton
//----------------------------------------------------------------------------
// Arguments:
//----------------------------------------------------------------------------
// Return Value:
//----------------------------------------------------------------------------
static AutomationMsgHandler& instance();
//>---------------------------------------------------------------------------
// Function: ~Proc
//
// Purpose: Destroyer
//----------------------------------------------------------------------------
// Arguments:
//----------------------------------------------------------------------------
// Return Value:
//----------------------------------------------------------------------------
~AutomationMsgHandler();
//>---------------------------------------------------------------------------
// Function: parseMsg
//
// Purpose:
//----------------------------------------------------------------------------
// Arguments:
//----------------------------------------------------------------------------
// Return Value:
//----------------------------------------------------------------------------
void handleMsg(const unsigned char* pData, const unsigned int& id);
private:
//>---------------------------------------------------------------------------
// Function: AutomationMsgHandler
//
// Purpose: Ctor
//----------------------------------------------------------------------------
// Arguments:
//----------------------------------------------------------------------------
// Return Value:
//----------------------------------------------------------------------------
AutomationMsgHandler();
//>---------------------------------------------------------------------------
// Function: HandleKwScenarioStartedMessage
//
// Purpose:
//----------------------------------------------------------------------------
// Arguments:
//----------------------------------------------------------------------------
// Return Value:
//----------------------------------------------------------------------------
void HandleKwScenarioStartedMessage(const unsigned char* pData);
//>---------------------------------------------------------------------------
// Function: HandleKwScenarioStoppedMessage
//
// Purpose:
//----------------------------------------------------------------------------
// Arguments:
//----------------------------------------------------------------------------
// Return Value:
//----------------------------------------------------------------------------
void HandleKwScenarioStoppedMessage(const unsigned char* pData);
};

View File

@@ -0,0 +1,179 @@
// UNCLASSIFIED
/*-------------------------------------------------------------------------
RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION
PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS
AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO
UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO
RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS
CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS
OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON
COMPANY.
THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S.
GOVERNMENT.
UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
-------------------------------------------------------------------------*/
#include <cerrno>
#include <cstdio>
#include <string.h>
#include <string>
#include <sstream>
#include "AutomationMsgParser.hpp"
#include "Exception.hpp"
#include "MessageHeader.hpp"
#include "MessageIDs.hpp"
#include "StringUtil.hpp"
//-----------------------------------------------------------------------------
AutomationMsgParser::AutomationMsgParser()
{
gatherCmdMessageIds();
}
//-----------------------------------------------------------------------------
AutomationMsgParser::~AutomationMsgParser(){}
//-----------------------------------------------------------------------------
AutomationMsgParser& AutomationMsgParser::instance()
{
static AutomationMsgParser parser;
return parser;
}
//-----------------------------------------------------------------------------
void AutomationMsgParser::gatherCmdMessageIds()
{
try {
msgIdsVec.push_back(MessageIDs::SCENARIO_STARTED_CMD);
msgIdsVec.push_back(MessageIDs::SCENARIO_STOPPED_CMD);
msgIdsVec.push_back(MessageIDs::GENERIC_RSP);
} catch (Exception& e) {
e.buildStackTrace(__FUNCTION_NAME__);
throw e;
}
}
//-----------------------------------------------------------------------------
void AutomationMsgParser::parseMsg(unsigned char* pData, unsigned int numBytes, unsigned int* pMsgId)
{
bool selfThrown = false;
try
{
MessageHeader header;
if (numBytes < header.GetHeaderLength())
{
std::stringstream ss;
ss << "Number of bytes received: " << numBytes << ". Expected minimum: " << header.GetHeaderLength();
selfThrown = true;
throw Exception(__FUNCTION_NAME__, ss.str());
}
// check to see if we recognize the header
unsigned int msgId = 0;
unsigned int msgLen = 0;
memcpy(&msgId, &pData[0], 4);
memcpy(&msgLen, &pData[4], 4);
if (std::find(msgIdsVec.begin(), msgIdsVec.end(), msgId) == msgIdsVec.end())
{
std::stringstream ss;
ss << "unexpected msg id: " << msgId;
selfThrown = true;
throw Exception(__FUNCTION_NAME__, ss.str());
}
if ( msgLen != numBytes)
{
std::stringstream ss;
ss << "Number of bytes received: " << numBytes << ". Expected only: " << msgLen;
selfThrown = true;
throw Exception(__FUNCTION_NAME__, ss.str());
}
if (numBytes > header.GetHeaderLength())
verifyDataFormat(pData, numBytes);
*pMsgId = msgId;
}
catch (Exception& e)
{
if (!selfThrown)
e.buildStackTrace(__FUNCTION_NAME__);
throw e;
}
}
//-----------------------------------------------------------------------------
void AutomationMsgParser::verifyDataFormat(unsigned char* pData, unsigned int numBytes)
{
MessageHeader header;
bool selfThrown = false;
unsigned char* pTempDataStart = pData + header.GetHeaderLength();
unsigned char* pTempDataEnd = pData + numBytes - 1;
// data format is
// [data header - 4 bytes][data - variable size]
// [data header][data][data header][data][data header][data][data header][data]
const unsigned int DATA_HEADER_LENGTH = 4;
try {
std::stringstream ssError;
ssError << "Data structure is incorrect.";
// want to make sure data size is at least 5 bytes
if (pTempDataStart+DATA_HEADER_LENGTH > pTempDataEnd)
{
selfThrown = true;
throw Exception(__FUNCTION_NAME__, ssError.str());
}
while (pTempDataStart < pTempDataEnd)
{
unsigned int dataSize = *(reinterpret_cast<unsigned int*>(pTempDataStart));
if (dataSize == 0)
{
selfThrown = true;
throw Exception(__FUNCTION_NAME__, ssError.str());
}
pTempDataStart += DATA_HEADER_LENGTH + dataSize;
if (pTempDataStart-1 > pTempDataEnd)
{
selfThrown = true;
throw Exception(__FUNCTION_NAME__, ssError.str());
}
else if (pTempDataStart-1 == pTempDataEnd)
break;
}
}
catch (Exception& e)
{
if (!selfThrown)
e.buildStackTrace(__FUNCTION_NAME__);
throw e;
}
}

View File

@@ -0,0 +1,94 @@
// UNCLASSIFIED
/*-------------------------------------------------------------------------
RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION
PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS
AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO
UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO
RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS
CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS
OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON
COMPANY.
THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S.
GOVERNMENT.
UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
-------------------------------------------------------------------------*/
#pragma once
#include "MessageIDs.hpp"
#include <vector>
class AutomationMsgParser
{
public:
//>---------------------------------------------------------------------------
// Function: instance
//
// Purpose: singleton
//----------------------------------------------------------------------------
// Arguments:
//----------------------------------------------------------------------------
// Return Value:
//----------------------------------------------------------------------------
static AutomationMsgParser& instance();
//>---------------------------------------------------------------------------
// Function: ~Proc
//
// Purpose: Destroyer
//----------------------------------------------------------------------------
// Arguments:
//----------------------------------------------------------------------------
// Return Value:
//----------------------------------------------------------------------------
~AutomationMsgParser();
//>---------------------------------------------------------------------------
// Function: parseMsg
//
// Purpose:
//----------------------------------------------------------------------------
// Arguments:
//----------------------------------------------------------------------------
// Return Value:
//----------------------------------------------------------------------------
void parseMsg(unsigned char* pData, unsigned int numBytes,unsigned int* pMsgId);
private:
//>---------------------------------------------------------------------------
// Function: AutomationMsgParser
//
// Purpose: Ctor
//----------------------------------------------------------------------------
// Arguments:
//----------------------------------------------------------------------------
// Return Value:
//----------------------------------------------------------------------------
AutomationMsgParser();
//>---------------------------------------------------------------------------
// Function: gatherCmdMessageIds
//
// Purpose:
//----------------------------------------------------------------------------
// Arguments:
//----------------------------------------------------------------------------
// Return Value:
//----------------------------------------------------------------------------
void gatherCmdMessageIds();
//>---------------------------------------------------------------------------
// Function: verifyDataFormat
//
// Purpose:
//----------------------------------------------------------------------------
// Arguments:
//----------------------------------------------------------------------------
// Return Value:
//----------------------------------------------------------------------------
void verifyDataFormat(unsigned char* pData, unsigned int numBytes);
std::vector<MessageIDs::MsgIds> msgIdsVec;
};

View File

@@ -0,0 +1,121 @@
// UNCLASSIFIED
/*-------------------------------------------------------------------------
RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION
PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS
AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO
UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO
RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS
CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS
OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON
COMPANY.
THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S.
GOVERNMENT.
UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
-------------------------------------------------------------------------*/
#include <sstream>
#include <string.h>
#include "GenericRspMessage.hpp"
#include "Exception.hpp"
//------------------------------------------------------------------------
GenericRspMessage::GenericRspMessage(const bool& wasCommandSuccessful):
Message(MessageIDs::GENERIC_RSP, "GENERIC_RSP", sizeof(MessageStruct)),
m_messageStruct()
{
m_messageStruct.wasCommandSuccessful = static_cast<unsigned int>(wasCommandSuccessful);
}
//------------------------------------------------------------------------
GenericRspMessage::GenericRspMessage(const GenericRspMessage& copy) :
Message(copy),
m_messageStruct(copy.m_messageStruct)
{
}
//------------------------------------------------------------------------
GenericRspMessage::~GenericRspMessage()
{
}
//------------------------------------------------------------------------
Message* GenericRspMessage::CloneSelf()
{
GenericRspMessage* pMsg = new GenericRspMessage(*this);
return pMsg;
}
//------------------------------------------------------------------------
void GenericRspMessage::ExecuteMessage()
{
try
{
}
catch (Exception& e)
{
e.buildStackTrace(__FUNCTION_NAME__);
throw e;
}
}
//------------------------------------------------------------------------
void GenericRspMessage::FormatData(unsigned char* pData)
{
// Here's how the data is formatted
// each data item is preceded by a 4-byte header which tells us the size of the data item
// 1 data item will have [header][data]
// 2 data items will have [header][data][header][data]
unsigned int dataLen = 0;
const unsigned char* pTempDataStart = pData + GetHeaderLength();
buildByteArray(&pTempDataStart, reinterpret_cast<char*>(&m_messageStruct.wasCommandSuccessful), sizeof(m_messageStruct.wasCommandSuccessful), dataLen);
// we want update total size of the entire message
m_header.SetMessageLength(static_cast<unsigned short>(dataLen));
m_header.Format(pData);
}
//------------------------------------------------------------------------
void GenericRspMessage::ParseData(const unsigned char* pData)
{
bool selfThrown = false;
const unsigned char* pTempDataStart = pData;
const unsigned char* pTempDataEnd = pData + m_header.GetMessageLength() - m_header.GetHeaderLength() - 1;
std::stringstream ss;
int sizeOfData = 0;
try {
sizeOfData = getNextDataItem(&pTempDataStart, pTempDataEnd, sizeOfData);
// make sure byte number match between what we're expected and what we receive
compareByteNumber(sizeof(m_messageStruct.wasCommandSuccessful), sizeOfData);
memcpy(&m_messageStruct.wasCommandSuccessful, pTempDataStart, sizeOfData);
}
catch (Exception & e) {
if (!selfThrown)
e.buildStackTrace(__FUNCTION_NAME__);
throw e;
}
}
//------------------------------------------------------------------------
std::string GenericRspMessage::ToString() const
{
std::stringstream ss;
ss << Message::ToString()
<< "wasCommandSuccessful: " << m_messageStruct.wasCommandSuccessful << "\n"
<< "\n";
return ss.str();
}

View File

@@ -0,0 +1,138 @@
// UNCLASSIFIED
/*-------------------------------------------------------------------------
RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION
PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS
AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO
UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO
RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS
CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS
OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON
COMPANY.
THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S.
GOVERNMENT.
UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
-------------------------------------------------------------------------*/
#pragma once
#include "Message.hpp"
#include "MessageIDs.hpp"
#include "MessageHeader.hpp"
class GenericRspMessage : public Message
{
public:
//>---------------------------------------------------------------------------
// Function: GenericRspMessage
//
// Purpose: constructor
//----------------------------------------------------------------------------
// Arguments:
//----------------------------------------------------------------------------
// Return Value:
//----------------------------------------------------------------------------
GenericRspMessage(const bool& wasCommandSuccessful);
//>---------------------------------------------------------------------------
// Function: GenericRspMessage
//
// Purpose: copy constructor
//----------------------------------------------------------------------------
// Arguments:
//----------------------------------------------------------------------------
// Return Value:
//----------------------------------------------------------------------------
GenericRspMessage(const GenericRspMessage &copy);
//>---------------------------------------------------------------------------
// Function: ~GenericRspMessage
//
// Purpose: destructor
//----------------------------------------------------------------------------
// Arguments:
//----------------------------------------------------------------------------
// Return Value:
//----------------------------------------------------------------------------
virtual ~GenericRspMessage();
//>---------------------------------------------------------------------------
// Function: GetSuccessfulFlag
//
// Purpose:
//----------------------------------------------------------------------------
// Arguments:
//----------------------------------------------------------------------------
// Return Value:
//----------------------------------------------------------------------------
bool GetSuccessfulFlag(){return static_cast<bool>(m_messageStruct.wasCommandSuccessful);}
//>---------------------------------------------------------------------------
// Function: ExecuteMessage
//
// Purpose:
//----------------------------------------------------------------------------
// Arguments:
//----------------------------------------------------------------------------
// Return Value:
//----------------------------------------------------------------------------
virtual void ExecuteMessage();
//>---------------------------------------------------------------------------
// Function: ToString
//
// Purpose:
//----------------------------------------------------------------------------
// Arguments:
//----------------------------------------------------------------------------
// Return Value:
//----------------------------------------------------------------------------
virtual std::string ToString() const;
protected:
//>---------------------------------------------------------------------------
// Function: CloneSelf
//
// Purpose:
//----------------------------------------------------------------------------
// Arguments:
//----------------------------------------------------------------------------
// Return Value:
//----------------------------------------------------------------------------
virtual Message* CloneSelf();
//>---------------------------------------------------------------------------
// Function: FormatData
//
// Purpose:
//----------------------------------------------------------------------------
// Arguments:
//----------------------------------------------------------------------------
// Return Value:
//----------------------------------------------------------------------------
virtual void FormatData(unsigned char* pData);
//>---------------------------------------------------------------------------
// Function: ParseData
//
// Purpose:
//----------------------------------------------------------------------------
// Arguments:
//----------------------------------------------------------------------------
// Return Value:
//----------------------------------------------------------------------------
virtual void ParseData(const unsigned char* pData);
private:
// do not allow
GenericRspMessage &operator=(const GenericRspMessage &rhs);
#pragma pack(1)
struct MessageStruct
{
unsigned int wasCommandSuccessful;
};
#pragma pack()
MessageStruct m_messageStruct;
};

View File

@@ -0,0 +1,97 @@
// UNCLASSIFIED
/*-------------------------------------------------------------------------
RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION
PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS
AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO
UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO
RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS
CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS
OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON
COMPANY.
THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S.
GOVERNMENT.
UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
-------------------------------------------------------------------------*/
#include <sstream>
#include <string.h>
#include "KwScenarioStarted.hpp"
#include "Exception.hpp"
#include "StringUtil.hpp"
#include "Proc.hpp"
#include "IniFile.hpp"
#include "GenericRspMessage.hpp"
//------------------------------------------------------------------------
KwScenarioStarted::KwScenarioStarted():
Message(MessageIDs::SCENARIO_STARTED_CMD, "SCENARIO_STARTED_CMD")
{
}
//------------------------------------------------------------------------
KwScenarioStarted::KwScenarioStarted(const KwScenarioStarted& copy) :
Message(copy)
{
}
//------------------------------------------------------------------------
KwScenarioStarted::~KwScenarioStarted()
{
}
//------------------------------------------------------------------------
Message* KwScenarioStarted::CloneSelf()
{
KwScenarioStarted* pMsg = new KwScenarioStarted(*this);
return pMsg;
}
//------------------------------------------------------------------------
void KwScenarioStarted::ExecuteMessage()
{
try
{
}
catch (Exception& e)
{
e.buildStackTrace(__FUNCTION_NAME__);
throw e;
}
}
//------------------------------------------------------------------------
void KwScenarioStarted::FormatData(unsigned char* pData)
{
// Here's how the data is formatted
// each data item is preceded by a 4-byte header which tells us the size of the data item
// 1 data item will have [header][data]
// 2 data items will have [header][data][header][data]
unsigned int dataLen = 0;
// we want update total size of the entire message
m_header.SetMessageLength(static_cast<unsigned short>(dataLen));
m_header.Format(pData);
}
//------------------------------------------------------------------------
void KwScenarioStarted::ParseData(const unsigned char*)
{
}
//------------------------------------------------------------------------
std::string KwScenarioStarted::ToString() const
{
std::stringstream ss;
return ss.str();
}

View File

@@ -0,0 +1,119 @@
// UNCLASSIFIED
/*-------------------------------------------------------------------------
RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION
PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS
AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO
UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO
RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS
CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS
OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON
COMPANY.
THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S.
GOVERNMENT.
UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
-------------------------------------------------------------------------*/
#pragma once
#include "Message.hpp"
#include "MessageIDs.hpp"
#include "MessageHeader.hpp"
class KwScenarioStarted : public Message
{
public:
//>---------------------------------------------------------------------------
// Function: KwScenarioStarted
//
// Purpose: constructor
//----------------------------------------------------------------------------
// Arguments:
//----------------------------------------------------------------------------
// Return Value:
//----------------------------------------------------------------------------
KwScenarioStarted();
//>---------------------------------------------------------------------------
// Function: KwScenarioStarted
//
// Purpose: copy constructor
//----------------------------------------------------------------------------
// Arguments:
//----------------------------------------------------------------------------
// Return Value:
//----------------------------------------------------------------------------
KwScenarioStarted(const KwScenarioStarted &copy);
//>---------------------------------------------------------------------------
// Function: ~KwScenarioStarted
//
// Purpose: destructor
//----------------------------------------------------------------------------
// Arguments:
//----------------------------------------------------------------------------
// Return Value:
//----------------------------------------------------------------------------
virtual ~KwScenarioStarted();
//>---------------------------------------------------------------------------
// Function: ExecuteMessage
//
// Purpose:
//----------------------------------------------------------------------------
// Arguments:
//----------------------------------------------------------------------------
// Return Value:
//----------------------------------------------------------------------------
virtual void ExecuteMessage();
//>---------------------------------------------------------------------------
// Function: ToString
//
// Purpose:
//----------------------------------------------------------------------------
// Arguments:
//----------------------------------------------------------------------------
// Return Value:
//----------------------------------------------------------------------------
virtual std::string ToString() const;
protected:
//>---------------------------------------------------------------------------
// Function: CloneSelf
//
// Purpose:
//----------------------------------------------------------------------------
// Arguments:
//----------------------------------------------------------------------------
// Return Value:
//----------------------------------------------------------------------------
virtual Message* CloneSelf();
//>---------------------------------------------------------------------------
// Function: FormatData
//
// Purpose:
//----------------------------------------------------------------------------
// Arguments:
//----------------------------------------------------------------------------
// Return Value:
//----------------------------------------------------------------------------
virtual void FormatData(unsigned char* pData);
//>---------------------------------------------------------------------------
// Function: ParseData
//
// Purpose:
//----------------------------------------------------------------------------
// Arguments:
//----------------------------------------------------------------------------
// Return Value:
//----------------------------------------------------------------------------
virtual void ParseData(const unsigned char*);
private:
// do not allow
KwScenarioStarted &operator=(const KwScenarioStarted &rhs);
};

View File

@@ -0,0 +1,114 @@
// UNCLASSIFIED
/*-------------------------------------------------------------------------
RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION
PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS
AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO
UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO
RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS
CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS
OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON
COMPANY.
THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S.
GOVERNMENT.
UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
-------------------------------------------------------------------------*/
#include <sstream>
#include <string.h>
#include "KwScenarioStopped.hpp"
#include "Exception.hpp"
#include "StringUtil.hpp"
#include "Proc.hpp"
#include "IniFile.hpp"
#include "GenericRspMessage.hpp"
//------------------------------------------------------------------------
KwScenarioStopped::KwScenarioStopped(std::string testDataPath):
Message(MessageIDs::SCENARIO_STOPPED_CMD, "SCENARIO_STOPPED_CMD"),
m_testDataPath(testDataPath)
{
}
//------------------------------------------------------------------------
KwScenarioStopped::KwScenarioStopped(const KwScenarioStopped& copy) :
Message(copy)
{
}
//------------------------------------------------------------------------
KwScenarioStopped::~KwScenarioStopped()
{
}
//------------------------------------------------------------------------
Message* KwScenarioStopped::CloneSelf()
{
KwScenarioStopped* pMsg = new KwScenarioStopped(*this);
return pMsg;
}
//------------------------------------------------------------------------
void KwScenarioStopped::ExecuteMessage()
{
try
{
}
catch (Exception& e)
{
e.buildStackTrace(__FUNCTION_NAME__);
throw e;
}
}
//------------------------------------------------------------------------
void KwScenarioStopped::FormatData(unsigned char* pData)
{
// Here's how the data is formatted
// each data item is preceded by a 4-byte header which tells us the size of the data item
// 1 data item will have [header][data]
// 2 data items will have [header][data][header][data]
unsigned int dataLen = 0;
const unsigned char* pTempDataStart = pData + GetHeaderLength();
buildByteArray(&pTempDataStart, m_testDataPath.c_str(), m_testDataPath.length(), dataLen);
// we want update total size of the entire message
m_header.SetMessageLength(static_cast<unsigned short>(dataLen));
m_header.Format(pData);
}
//------------------------------------------------------------------------
void KwScenarioStopped::ParseData(const unsigned char* pData)
{
const unsigned char* pTempDataStart = pData;
const unsigned char* pTempDataEnd = pData + m_header.GetMessageLength() - m_header.GetHeaderLength() - 1;
int sizeOfData = 0;
try {
sizeOfData = getNextDataItem(&pTempDataStart, pTempDataEnd, sizeOfData);
m_testDataPath = Util::Strings::ByteArrayToString(const_cast<unsigned char*>(pTempDataStart), sizeOfData);
}
catch (Exception& e) {
e.buildStackTrace(__FUNCTION_NAME__);
throw e;
}
}
//------------------------------------------------------------------------
std::string KwScenarioStopped::ToString() const
{
std::stringstream ss;
return ss.str();
}

View File

@@ -0,0 +1,121 @@
// UNCLASSIFIED
/*-------------------------------------------------------------------------
RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION
PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS
AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO
UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO
RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS
CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS
OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON
COMPANY.
THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S.
GOVERNMENT.
UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
-------------------------------------------------------------------------*/
#pragma once
#include "Message.hpp"
#include "MessageIDs.hpp"
#include "MessageHeader.hpp"
class KwScenarioStopped : public Message
{
public:
//>---------------------------------------------------------------------------
// Function: KwScenarioStopped
//
// Purpose: constructor
//----------------------------------------------------------------------------
// Arguments:
//----------------------------------------------------------------------------
// Return Value:
//----------------------------------------------------------------------------
KwScenarioStopped(std::string testDataPath);
//>---------------------------------------------------------------------------
// Function: KwScenarioStopped
//
// Purpose: copy constructor
//----------------------------------------------------------------------------
// Arguments:
//----------------------------------------------------------------------------
// Return Value:
//----------------------------------------------------------------------------
KwScenarioStopped(const KwScenarioStopped &copy);
//>---------------------------------------------------------------------------
// Function: ~KwScenarioStopped
//
// Purpose: destructor
//----------------------------------------------------------------------------
// Arguments:
//----------------------------------------------------------------------------
// Return Value:
//----------------------------------------------------------------------------
virtual ~KwScenarioStopped();
//>---------------------------------------------------------------------------
// Function: ExecuteMessage
//
// Purpose:
//----------------------------------------------------------------------------
// Arguments:
//----------------------------------------------------------------------------
// Return Value:
//----------------------------------------------------------------------------
virtual void ExecuteMessage();
//>---------------------------------------------------------------------------
// Function: ToString
//
// Purpose:
//----------------------------------------------------------------------------
// Arguments:
//----------------------------------------------------------------------------
// Return Value:
//----------------------------------------------------------------------------
virtual std::string ToString() const;
protected:
//>---------------------------------------------------------------------------
// Function: CloneSelf
//
// Purpose:
//----------------------------------------------------------------------------
// Arguments:
//----------------------------------------------------------------------------
// Return Value:
//----------------------------------------------------------------------------
virtual Message* CloneSelf();
//>---------------------------------------------------------------------------
// Function: FormatData
//
// Purpose:
//----------------------------------------------------------------------------
// Arguments:
//----------------------------------------------------------------------------
// Return Value:
//----------------------------------------------------------------------------
virtual void FormatData(unsigned char* pData);
//>---------------------------------------------------------------------------
// Function: ParseData
//
// Purpose:
//----------------------------------------------------------------------------
// Arguments:
//----------------------------------------------------------------------------
// Return Value:
//----------------------------------------------------------------------------
virtual void ParseData(const unsigned char*);
private:
// do not allow
KwScenarioStopped &operator=(const KwScenarioStopped &rhs);
std::string m_testDataPath;
};

View File

@@ -0,0 +1,192 @@
// UNCLASSIFIED
/*-------------------------------------------------------------------------
RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION
PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS
AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO
UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO
RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS
CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS
OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON
COMPANY.
THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S.
GOVERNMENT.
UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
-------------------------------------------------------------------------*/
#include <sstream>
#include "Message.hpp"
#include "Exception.hpp"
//------------------------------------------------------------------------
Message::Message(const MessageIDs::MsgIds& id,
const std::string& description,
const unsigned short& messageLen) :
m_header(id, messageLen),
m_description(description)
{
}
//------------------------------------------------------------------------
Message::Message(const Message& copy) :
m_header(copy.m_header),
m_description(copy.m_description)
{
}
//------------------------------------------------------------------------
Message::~Message()
{
}
//------------------------------------------------------------------------
Message* Message::Clone()
{
return CloneSelf();
}
//------------------------------------------------------------------------
void Message::Format(unsigned char* pBuffer)
{
try
{
m_header.Format(pBuffer);
FormatData(pBuffer);
}
catch (Exception& e)
{
e.buildStackTrace(__FUNCTION_NAME__);
throw e;
}
}
//------------------------------------------------------------------------
std::string Message::GetDescription() const
{
return m_description;
}
//------------------------------------------------------------------------
void Message::Parse(const unsigned char* pData)
{
try
{
m_header.Parse(pData);
ParseData(pData + GetHeaderLength());
}
catch (Exception& e)
{
e.buildStackTrace(__FUNCTION_NAME__);
throw e;
}
}
//------------------------------------------------------------------------
void Message::SetMessageLength(const unsigned short& length)
{
m_header.SetMessageLength(length);
}
//------------------------------------------------------------------------
std::string Message::ToString() const
{
std::stringstream ss;
ss << "Description: " << GetDescription() << "\n" << m_header.ToString();
return ss.str();
}
//------------------------------------------------------------------------
int Message::getNextDataItem(const unsigned char** pStartBuf, const unsigned char* pEndBuf, int& sizeOfPreviousData)
{
bool selfThrown = false;
int sizeOfDataHeader = 4;
int sizeOfData = 0;
std::stringstream ssError;
*pStartBuf += sizeOfPreviousData;
try
{
// make sure 4 bytes of header information is present
if (*pStartBuf + sizeOfDataHeader > pEndBuf)
{
selfThrown = true;
throw Exception(__FUNCTION_NAME__, ssError.str());
}
sizeOfData = *(*pStartBuf);
// we want to make sure the nth header and nth data information match
// header tells us how many bytes in the nth data item, and the bytes
// of data is present in the buffer
if (*pStartBuf + sizeOfDataHeader + sizeOfData -1 <= pEndBuf)
{
// points to the address of the nth data item
*pStartBuf += sizeOfDataHeader;
}
else
{
selfThrown = true;
throw Exception(__FUNCTION_NAME__, ssError.str());
}
}
catch (Exception& e)
{
if (!selfThrown)
e.buildStackTrace(__FUNCTION_NAME__);
throw e;
}
return sizeOfData;
}
//------------------------------------------------------------------------
void Message::buildByteArray(const unsigned char** pStartBuf, const char* data, const int& sizeOfDataBytes, unsigned int& totalBytesInArray)
{
// copy the header information for this data item
memcpy(const_cast<unsigned char*>(*pStartBuf), &sizeOfDataBytes, sizeof(sizeOfDataBytes));
*pStartBuf += sizeof(sizeOfDataBytes);
totalBytesInArray += sizeof(sizeOfDataBytes);
// copy the data for this data item
memcpy(const_cast<unsigned char*>(*pStartBuf), data, sizeOfDataBytes);
*pStartBuf += sizeOfDataBytes;
totalBytesInArray += sizeOfDataBytes;
}
//------------------------------------------------------------------------
void Message::compareByteNumber(int expectedNumBytes, int actualNumbyte)
{
bool selfThrown = false;
std::stringstream ss;
try
{
if (expectedNumBytes != actualNumbyte)
{
selfThrown = true;
ss << "Expected number of bytes received: " << expectedNumBytes << ". Actual number of bytes received: " << actualNumbyte;
throw Exception(__FUNCTION_NAME__, ss.str());
}
}
catch (Exception & e) {
if (!selfThrown)
e.buildStackTrace(__FUNCTION_NAME__);
throw e;
}
}

View File

@@ -0,0 +1,257 @@
// UNCLASSIFIED
/*-------------------------------------------------------------------------
RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION
PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS
AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO
UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO
RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS
CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS
OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON
COMPANY.
THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S.
GOVERNMENT.
UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
-------------------------------------------------------------------------*/
#pragma once
#include <iostream>
#include "MessageIDs.hpp"
#include "MessageHeader.hpp"
class Message
{
public:
//>---------------------------------------------------------------------
// Function: ~Message()
//
// Purpose: destructor
//----------------------------------------------------------------------
// Arguments: none
//----------------------------------------------------------------------
// Return Value: none
//<---------------------------------------------------------------------
virtual ~Message();
//>---------------------------------------------------------------------
// Function: Clone()
//
// Purpose: Get a copy of this object
//----------------------------------------------------------------------
// Arguments: none
//----------------------------------------------------------------------
// Return Value: a copy of this object
//<---------------------------------------------------------------------
virtual Message* Clone();
//>---------------------------------------------------------------------
// Function: ExecuteMessage()
//
// Purpose: Executes this message
//----------------------------------------------------------------------
// Arguments: none
//----------------------------------------------------------------------
// Return Value: none
//<---------------------------------------------------------------------
virtual void ExecuteMessage() = 0;
//>---------------------------------------------------------------------
// Function: Format()
//
// Purpose: Formats this message for sending
//----------------------------------------------------------------------
// Arguments: pBuffer - the buffer to put the formatting data in
//----------------------------------------------------------------------
// Return Value: none
//<---------------------------------------------------------------------
virtual void Format(unsigned char* pBuffer);
//>---------------------------------------------------------------------
// Function: GetDescription()
//
// Purpose: Getter for this objects description
//----------------------------------------------------------------------
// Arguments: none
//----------------------------------------------------------------------
// Return Value: The description
//<---------------------------------------------------------------------
virtual std::string GetDescription() const;
//>---------------------------------------------------------------------
// Function: GetMessageID()
//
// Purpose: Getter for this objects message id
//----------------------------------------------------------------------
// Arguments: none
//----------------------------------------------------------------------
// Return Value: The id
//<---------------------------------------------------------------------
virtual MessageIDs::MsgIds GetMessageID() { return m_header.GetMessageId(); }
//>---------------------------------------------------------------------
// Function: GetEntireMessageLength()
//
// Purpose: Getter for this objects message number of bytes, including the header
//----------------------------------------------------------------------
// Arguments: none
//----------------------------------------------------------------------
// Return Value: The entire message number of bytes
//<---------------------------------------------------------------------
virtual unsigned int GetEntireMessageLength() const { return m_header.GetMessageLength();}
//>---------------------------------------------------------------------
// Function: GetHeaderLength()
//
// Purpose: Getter for this objects message number of header bytes
//----------------------------------------------------------------------
// Arguments: none
//----------------------------------------------------------------------
// Return Value: The header number of bytes
//<---------------------------------------------------------------------
virtual unsigned short GetHeaderLength() const { return m_header.GetHeaderLength();}
//>---------------------------------------------------------------------
// Function: Parse()
//
// Purpose: Takes an array of bytes and populates this object
//----------------------------------------------------------------------
// Arguments: The array of bytes
//----------------------------------------------------------------------
// Return Value: None
//<---------------------------------------------------------------------
virtual void Parse(const unsigned char* pData);
//>---------------------------------------------------------------------
// Function: ToString()
//
// Purpose: Converts this object into a string
//----------------------------------------------------------------------
// Arguments: None
//----------------------------------------------------------------------
// Return Value: The string form of this object
//<---------------------------------------------------------------------
virtual std::string ToString() const;
protected:
//>---------------------------------------------------------------------
// Function: Constructor
//
// Purpose: The constructor for the childern to call
//----------------------------------------------------------------------
// Arguments: id - the message id
// description - the message description
// messageLen - the number of bytes in the message payload (not including the header)
//----------------------------------------------------------------------
// Return Value: The object
//<---------------------------------------------------------------------
Message(const MessageIDs::MsgIds& id,
const std::string& description,
const unsigned short& messageLen = 0);
//>---------------------------------------------------------------------
// Function: Copy Constructor
//
// Purpose: Create a copy of this object
//----------------------------------------------------------------------
// Arguments: copy - the object to copy
//----------------------------------------------------------------------
// Return Value: The object
//<---------------------------------------------------------------------
Message(const Message &copy);
//>---------------------------------------------------------------------
// Function: CloneSelf
//
// Purpose: Pure virtual function for children to implement.
// Create a clone of this object
//----------------------------------------------------------------------
// Arguments: none
//----------------------------------------------------------------------
// Return Value: The object
//<---------------------------------------------------------------------
virtual Message* CloneSelf() = 0;
//>---------------------------------------------------------------------
// Function: FormatData
//
// Purpose: Pure virtual function for children to implement.
// Format the data
//----------------------------------------------------------------------
// Arguments: pData - the buffer to format to
//----------------------------------------------------------------------
// Return Value: none
//<---------------------------------------------------------------------
virtual void FormatData(unsigned char* pData) = 0;
//>---------------------------------------------------------------------
// Function: ParseData
//
// Purpose: Pure virtual function for children to implement.
// Parse the data
//----------------------------------------------------------------------
// Arguments: pData - the buffer to parse from
//----------------------------------------------------------------------
// Return Value: none
//<---------------------------------------------------------------------
virtual void ParseData(const unsigned char* pData) = 0;
//>---------------------------------------------------------------------
// Function: SetMessageLength
//
// Purpose: Sets the message length of the payload of the message (not the header)
//----------------------------------------------------------------------
// Arguments: length - the number of bytes in the payload
//----------------------------------------------------------------------
// Return Value: none
//<---------------------------------------------------------------------
virtual void SetMessageLength(const unsigned short& length);
//>---------------------------------------------------------------------
// Function: getStartOfNthDataItem
//
// Purpose:
// get the starting address of the nth data item
// data format:
// [data header][data][data header][data]...
//----------------------------------------------------------------------
// Arguments:
//----------------------------------------------------------------------
// Return Value: none
//<---------------------------------------------------------------------
int getNextDataItem(const unsigned char** pStartBuf, const unsigned char* pEndBuf, int& sizeOfPreviousData);
//>---------------------------------------------------------------------
// Function: buildByteArray
//
// Purpose:
// this will add to the byte array a data item
// data format:
// [data header][data]
//----------------------------------------------------------------------
// Arguments:
//----------------------------------------------------------------------
// Return Value: none
//<---------------------------------------------------------------------
void buildByteArray(const unsigned char** pStartBuf, const char* data, const int& sizeOfDataBytes, unsigned int& totalBytesInArray);
//>---------------------------------------------------------------------
// Function: compareByteNumber
//
// Purpose:
//----------------------------------------------------------------------
// Arguments:
//----------------------------------------------------------------------
// Return Value: none
//<---------------------------------------------------------------------
void compareByteNumber(int expectedNumBytes, int actualNumbyte);
MessageHeader m_header;
private:
// do not allow
Message();
Message &operator=(const Message &rhs);
std::string m_description;
};

View File

@@ -0,0 +1,102 @@
// UNCLASSIFIED
/*-------------------------------------------------------------------------
RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION
PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS
AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO
UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO
RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS
CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS
OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON
COMPANY.
THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S.
GOVERNMENT.
UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
-------------------------------------------------------------------------*/
#include <sstream>
#include <string.h>
#include "MessageHeader.hpp"
//------------------------------------------------------------------------
MessageHeader::MessageHeader(const MessageIDs::MsgIds& id, const unsigned short& messageLen) :
m_headerStruct()
{
m_headerStruct.messageId = id;
m_headerStruct.messageLength = messageLen + GetHeaderLength();
}
//------------------------------------------------------------------------
MessageHeader::MessageHeader() :
m_headerStruct()
{
m_headerStruct.messageId = 0;
m_headerStruct.messageLength = 0;
}
//------------------------------------------------------------------------
MessageHeader::MessageHeader(const MessageHeader& copy) :
m_headerStruct(copy.m_headerStruct)
{
}
//------------------------------------------------------------------------
MessageHeader::~MessageHeader()
{
}
//------------------------------------------------------------------------
void MessageHeader::Format(unsigned char* pData)
{
memcpy(pData, &m_headerStruct, GetHeaderLength());
}
//------------------------------------------------------------------------
MessageIDs::MsgIds MessageHeader::GetMessageId()
{
return (MessageIDs::MsgIds)m_headerStruct.messageId;
}
//------------------------------------------------------------------------
unsigned short MessageHeader::GetHeaderLength() const
{
return sizeof(m_headerStruct);
}
//------------------------------------------------------------------------
unsigned int MessageHeader::GetMessageLength() const
{
return m_headerStruct.messageLength;
}
//------------------------------------------------------------------------
void MessageHeader::Parse(const unsigned char* pData)
{
::memcpy(&m_headerStruct, pData, GetHeaderLength());
}
//------------------------------------------------------------------------
void MessageHeader::SetMessageLength(const unsigned short& length)
{
m_headerStruct.messageLength = length + GetHeaderLength();
}
//------------------------------------------------------------------------
std::string MessageHeader::ToString() const
{
std::stringstream ss;
ss << "msg id: " << m_headerStruct.messageId << "\n" << "msg len: " << m_headerStruct.messageLength << "\n";
return ss.str();
}

View File

@@ -0,0 +1,161 @@
// UNCLASSIFIED
/*-------------------------------------------------------------------------
RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION
PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS
AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO
UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO
RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS
CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS
OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON
COMPANY.
THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S.
GOVERNMENT.
UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
-------------------------------------------------------------------------*/
#pragma once
#include "MessageIDs.hpp"
class MessageHeader
{
public:
//>---------------------------------------------------------------------
// Function: MessageHeader
//
// Purpose: constructor
//----------------------------------------------------------------------
// Arguments: id - the message id
// messageLen - the number of bytes of the entire message including the header
//----------------------------------------------------------------------
// Return Value: none
//<---------------------------------------------------------------------
MessageHeader(const MessageIDs::MsgIds& id, const unsigned short& messageLen);
//>---------------------------------------------------------------------
// Function: MessageHeader
//
// Purpose: constructor
//----------------------------------------------------------------------
// Arguments: none
//----------------------------------------------------------------------
// Return Value: none
//<---------------------------------------------------------------------
MessageHeader();
//>---------------------------------------------------------------------
// Function: Copy Constructor
//
// Purpose: Create a copy of this object
//----------------------------------------------------------------------
// Arguments: copy - the object to copy
//----------------------------------------------------------------------
// Return Value: The object
//<---------------------------------------------------------------------
MessageHeader(const MessageHeader &copy);
//>---------------------------------------------------------------------
// Function: ~MessageHeader()
//
// Purpose: destructor
//----------------------------------------------------------------------
// Arguments: none
//----------------------------------------------------------------------
// Return Value: none
//<---------------------------------------------------------------------
virtual ~MessageHeader();
//>---------------------------------------------------------------------
// Function: Format()
//
// Purpose: Formats this message for sending
//----------------------------------------------------------------------
// Arguments: pBuffer - the buffer to put the formatting data in
//----------------------------------------------------------------------
// Return Value: none
//<---------------------------------------------------------------------
void Format(unsigned char* pData);
//>---------------------------------------------------------------------
// Function: GetHeaderLength()
//
// Purpose: Get the number of bytes in the header
//----------------------------------------------------------------------
// Arguments: none
//----------------------------------------------------------------------
// Return Value: number of bytes in the header
//<---------------------------------------------------------------------
unsigned short GetHeaderLength() const;
//>---------------------------------------------------------------------
// Function: GetMessageLength()
//
// Purpose: Get the number of bytes in the entire message, including header
//----------------------------------------------------------------------
// Arguments: none
//----------------------------------------------------------------------
// Return Value: number of bytes in the message
//<---------------------------------------------------------------------
unsigned int GetMessageLength() const;
//>---------------------------------------------------------------------
// Function: GetMessageId()
//
// Purpose: Get the message id
//----------------------------------------------------------------------
// Arguments: none
//----------------------------------------------------------------------
// Return Value: the message id
//<---------------------------------------------------------------------
MessageIDs::MsgIds GetMessageId();
//>---------------------------------------------------------------------
// Function: Parse()
//
// Purpose: Takes an array of bytes and populates this object
//----------------------------------------------------------------------
// Arguments: The array of bytes
//----------------------------------------------------------------------
// Return Value: None
//<---------------------------------------------------------------------
void Parse(const unsigned char* pData);
//>---------------------------------------------------------------------
// Function: SetMessageLength
//
// Purpose: Sets the message length of the payload of the message (not the header)
//----------------------------------------------------------------------
// Arguments: length - the number of bytes in the payload
//----------------------------------------------------------------------
// Return Value: none
//<---------------------------------------------------------------------
void SetMessageLength(const unsigned short& length);
//>---------------------------------------------------------------------
// Function: ToString()
//
// Purpose: Converts this object into a string
//----------------------------------------------------------------------
// Arguments: None
//----------------------------------------------------------------------
// Return Value: The string form of this object
//<---------------------------------------------------------------------
std::string ToString() const;
protected:
private:
// do not allow
MessageHeader &operator=(const MessageHeader &rhs);
#pragma pack(1)
struct HeaderStruct
{
unsigned int messageId;
unsigned int messageLength;
};
#pragma pack()
HeaderStruct m_headerStruct;
};

View File

@@ -0,0 +1,35 @@
// UNCLASSIFIED
/*-------------------------------------------------------------------------
RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION
PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS
AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO
UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO
RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS
CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS
OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON
COMPANY.
THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S.
GOVERNMENT.
UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
-------------------------------------------------------------------------*/
#pragma once
namespace MessageIDs
{
enum MsgIds
{
TRANSFER_A_FILE_CMD = 0xCA001001,
TRANSFER_A_FOLDER_CMD = 0xCA001002,
TRANSFER_GUTS_VIDEOS_CMD = 0xCA001003,
MOVE_GUTS_VIDEOS_TO_SUB_FOLDER_CMD = 0xCA001004,
SCENARIO_STARTED_CMD = 0xCA001005,
SCENARIO_STOPPED_CMD = 0xCA001006,
WAIT_FOR_COMPLETION_CMD = 0xCA002000,
GENERIC_RSP = 0xCA002001
};
}

View File

@@ -0,0 +1,116 @@
// UNCLASSIFIED
/*-------------------------------------------------------------------------
RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION
PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS
AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO
UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO
RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS
CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS
OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON
COMPANY.
THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S.
GOVERNMENT.
UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
-------------------------------------------------------------------------*/
#include <sstream>
#include <string.h>
#include "MoveGutsVideosToSubFolderCmdMessage.hpp"
#include "Exception.hpp"
#include "StringUtil.hpp"
//------------------------------------------------------------------------
MoveGutsVideosToSubFolderCmdMessage::MoveGutsVideosToSubFolderCmdMessage(std::string subFolder):
Message(MessageIDs::MOVE_GUTS_VIDEOS_TO_SUB_FOLDER_CMD, "MOVE_GUTS_VIDEOS_TO_SUB_FOLDER_CMD"),
m_subFolder(subFolder)
{
}
//------------------------------------------------------------------------
MoveGutsVideosToSubFolderCmdMessage::MoveGutsVideosToSubFolderCmdMessage(const MoveGutsVideosToSubFolderCmdMessage& copy) :
Message(copy),
m_subFolder(copy.m_subFolder)
{
}
//------------------------------------------------------------------------
MoveGutsVideosToSubFolderCmdMessage::~MoveGutsVideosToSubFolderCmdMessage()
{
}
//------------------------------------------------------------------------
Message* MoveGutsVideosToSubFolderCmdMessage::CloneSelf()
{
MoveGutsVideosToSubFolderCmdMessage* pMsg = new MoveGutsVideosToSubFolderCmdMessage(*this);
return pMsg;
}
//------------------------------------------------------------------------
void MoveGutsVideosToSubFolderCmdMessage::ExecuteMessage()
{
try
{
}
catch (Exception& e)
{
e.buildStackTrace(__FUNCTION_NAME__);
throw e;
}
}
//------------------------------------------------------------------------
void MoveGutsVideosToSubFolderCmdMessage::FormatData(unsigned char* pData)
{
// Here's how the data is formatted
// each data item is preceded by a 4-byte header which tells us the size of the data item
// 1 data item will have [header][data]
// 2 data items will have [header][data][header][data]
unsigned int dataLen = 0;
const unsigned char* pTempDataStart = pData + GetHeaderLength();
buildByteArray(&pTempDataStart, m_subFolder.c_str(), m_subFolder.length(), dataLen);
// we want update total size of the entire message
m_header.SetMessageLength(static_cast<unsigned short>(dataLen));
m_header.Format(pData);
}
//------------------------------------------------------------------------
void MoveGutsVideosToSubFolderCmdMessage::ParseData(const unsigned char* pData)
{
bool selfThrown = false;
const unsigned char* pTempDataStart = pData;
const unsigned char* pTempDataEnd = pData + m_header.GetMessageLength() - m_header.GetHeaderLength() - 1;
int sizeOfData = 0;
try {
sizeOfData = getNextDataItem(&pTempDataStart, pTempDataEnd, sizeOfData);
m_subFolder = Util::Strings::ByteArrayToString(const_cast<unsigned char*>(pTempDataStart), sizeOfData);
} catch (Exception& e) {
if (!selfThrown)
e.buildStackTrace(__FUNCTION_NAME__);
throw e;
}
}
//------------------------------------------------------------------------
std::string MoveGutsVideosToSubFolderCmdMessage::ToString() const
{
std::stringstream ss;
ss << "Subfolder name: " << m_subFolder;
return ss.str();
}

View File

@@ -0,0 +1,120 @@
// UNCLASSIFIED
/*-------------------------------------------------------------------------
RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION
PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS
AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO
UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO
RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS
CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS
OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON
COMPANY.
THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S.
GOVERNMENT.
UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
-------------------------------------------------------------------------*/
#pragma once
#include "Message.hpp"
#include "MessageIDs.hpp"
#include "MessageHeader.hpp"
class MoveGutsVideosToSubFolderCmdMessage : public Message
{
public:
//>---------------------------------------------------------------------------
// Function: MoveGutsVideosToSubFolderCmdMessage
//
// Purpose: constructor
//----------------------------------------------------------------------------
// Arguments:
//----------------------------------------------------------------------------
// Return Value:
//----------------------------------------------------------------------------
MoveGutsVideosToSubFolderCmdMessage(std::string subFolder = "");
//>---------------------------------------------------------------------------
// Function: MoveGutsVideosToSubFolderCmdMessage
//
// Purpose: copy constructor
//----------------------------------------------------------------------------
// Arguments:
//----------------------------------------------------------------------------
// Return Value:
//----------------------------------------------------------------------------
MoveGutsVideosToSubFolderCmdMessage(const MoveGutsVideosToSubFolderCmdMessage &copy);
//>---------------------------------------------------------------------------
// Function: ~MoveGutsVideosToSubFolderCmdMessage
//
// Purpose: destructor
//----------------------------------------------------------------------------
// Arguments:
//----------------------------------------------------------------------------
// Return Value:
//----------------------------------------------------------------------------
virtual ~MoveGutsVideosToSubFolderCmdMessage();
//>---------------------------------------------------------------------------
// Function: ExecuteMessage
//
// Purpose:
//----------------------------------------------------------------------------
// Arguments:
//----------------------------------------------------------------------------
// Return Value:
//----------------------------------------------------------------------------
virtual void ExecuteMessage();
//>---------------------------------------------------------------------------
// Function: ToString
//
// Purpose:
//----------------------------------------------------------------------------
// Arguments:
//----------------------------------------------------------------------------
// Return Value:
//----------------------------------------------------------------------------
virtual std::string ToString() const;
protected:
//>---------------------------------------------------------------------------
// Function: CloneSelf
//
// Purpose:
//----------------------------------------------------------------------------
// Arguments:
//----------------------------------------------------------------------------
// Return Value:
//----------------------------------------------------------------------------
virtual Message* CloneSelf();
//>---------------------------------------------------------------------------
// Function: FormatData
//
// Purpose:
//----------------------------------------------------------------------------
// Arguments:
//----------------------------------------------------------------------------
// Return Value:
//----------------------------------------------------------------------------
virtual void FormatData(unsigned char* pData);
//>---------------------------------------------------------------------------
// Function: ParseData
//
// Purpose:
//----------------------------------------------------------------------------
// Arguments:
//----------------------------------------------------------------------------
// Return Value:
//----------------------------------------------------------------------------
virtual void ParseData(const unsigned char* pData);
private:
// do not allow
MoveGutsVideosToSubFolderCmdMessage &operator=(const MoveGutsVideosToSubFolderCmdMessage &rhs);
std::string m_subFolder;
};

View File

@@ -0,0 +1,136 @@
// UNCLASSIFIED
/*-------------------------------------------------------------------------
RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION
PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS
AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO
UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO
RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS
CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS
OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON
COMPANY.
THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S.
GOVERNMENT.
UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
-------------------------------------------------------------------------*/
#include <sstream>
#include <string.h>
#include "TransferAFileCmdMessage.hpp"
#include "Exception.hpp"
#include "StringUtil.hpp"
//------------------------------------------------------------------------
TransferAFileCmdMessage::TransferAFileCmdMessage(std::string fromFile, std::string toFile, bool deleteSource):
Message(MessageIDs::TRANSFER_A_FILE_CMD, "TRANSFER_A_FILE_CMD"),
m_fromFile(fromFile),
m_toFile(toFile),
m_deleteSource(static_cast<int>(deleteSource))
{
}
//------------------------------------------------------------------------
TransferAFileCmdMessage::TransferAFileCmdMessage(const TransferAFileCmdMessage& copy) :
Message(copy),
m_fromFile(copy.m_fromFile),
m_toFile(copy.m_toFile),
m_deleteSource(copy.m_deleteSource)
{
}
//------------------------------------------------------------------------
TransferAFileCmdMessage::~TransferAFileCmdMessage()
{
}
//------------------------------------------------------------------------
Message* TransferAFileCmdMessage::CloneSelf()
{
TransferAFileCmdMessage* pMsg = new TransferAFileCmdMessage(*this);
return pMsg;
}
//------------------------------------------------------------------------
void TransferAFileCmdMessage::ExecuteMessage()
{
try
{
}
catch (Exception& e)
{
e.buildStackTrace(__FUNCTION_NAME__);
throw e;
}
}
//------------------------------------------------------------------------
void TransferAFileCmdMessage::FormatData(unsigned char* pData)
{
// Here's how the data is formatted
// each data item is preceded by a 4-byte header which tells us the size of the data item
// 1 data item will have [header][data]
// 2 data items will have [header][data][header][data]
unsigned int dataLen = 0;
const unsigned char* pTempDataStart = pData + GetHeaderLength();
buildByteArray(&pTempDataStart, m_fromFile.c_str(), m_fromFile.length(), dataLen);
buildByteArray(&pTempDataStart, m_toFile.c_str(), m_toFile.length(), dataLen);
buildByteArray(&pTempDataStart, reinterpret_cast<char*>(&m_deleteSource), sizeof(m_deleteSource), dataLen);
// we want update total size of the entire message
m_header.SetMessageLength(static_cast<unsigned short>(dataLen));
m_header.Format(pData);
}
//------------------------------------------------------------------------
void TransferAFileCmdMessage::ParseData(const unsigned char* pData)
{
bool selfThrown = false;
const unsigned char* pTempDataStart = pData;
const unsigned char* pTempDataEnd = pData + m_header.GetMessageLength() - m_header.GetHeaderLength() - 1;
int sizeOfData = 0;
try {
sizeOfData = getNextDataItem(&pTempDataStart, pTempDataEnd, sizeOfData);
m_fromFile = Util::Strings::ByteArrayToString(const_cast<unsigned char*>(pTempDataStart), sizeOfData);
sizeOfData = getNextDataItem(&pTempDataStart, pTempDataEnd, sizeOfData);
getNextDataItem(&pTempDataStart, pTempDataEnd, sizeOfData);
sizeOfData = getNextDataItem(&pTempDataStart, pTempDataEnd, sizeOfData);
m_toFile = Util::Strings::ByteArrayToString(const_cast<unsigned char*>(pTempDataStart), sizeOfData);
sizeOfData = getNextDataItem(&pTempDataStart, pTempDataEnd, sizeOfData);
getNextDataItem(&pTempDataStart, pTempDataEnd, sizeOfData);
sizeOfData = getNextDataItem(&pTempDataStart, pTempDataEnd, sizeOfData);
// make sure byte number match between what we're expected and what we receive
compareByteNumber(sizeof(m_deleteSource), sizeOfData);
memcpy(&m_deleteSource, pTempDataStart, sizeOfData);
} catch (Exception& e) {
if (!selfThrown)
e.buildStackTrace(__FUNCTION_NAME__);
throw e;
}
}
//------------------------------------------------------------------------
std::string TransferAFileCmdMessage::ToString() const
{
std::stringstream ss;
ss << "From file: " << m_fromFile << ". To file: " << m_toFile << ". Delete source: " << m_deleteSource;
return ss.str();
}

View File

@@ -0,0 +1,124 @@
// UNCLASSIFIED
/*-------------------------------------------------------------------------
RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION
PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS
AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO
UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO
RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS
CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS
OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON
COMPANY.
THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S.
GOVERNMENT.
UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
-------------------------------------------------------------------------*/
#pragma once
#include "Message.hpp"
#include "MessageIDs.hpp"
#include "MessageHeader.hpp"
class TransferAFileCmdMessage : public Message
{
public:
//>---------------------------------------------------------------------------
// Function: TransferAFileCmdMessage
//
// Purpose: constructor
//----------------------------------------------------------------------------
// Arguments:
//----------------------------------------------------------------------------
// Return Value:
//----------------------------------------------------------------------------
TransferAFileCmdMessage(std::string fromFile = "", std::string toFile = "", bool deleteSource = false);
//>---------------------------------------------------------------------------
// Function: TransferAFileCmdMessage
//
// Purpose: copy constructor
//----------------------------------------------------------------------------
// Arguments:
//----------------------------------------------------------------------------
// Return Value:
//----------------------------------------------------------------------------
TransferAFileCmdMessage(const TransferAFileCmdMessage &copy);
//>---------------------------------------------------------------------------
// Function: ~TransferAFileCmdMessage
//
// Purpose: destructor
//----------------------------------------------------------------------------
// Arguments:
//----------------------------------------------------------------------------
// Return Value:
//----------------------------------------------------------------------------
virtual ~TransferAFileCmdMessage();
//>---------------------------------------------------------------------------
// Function: ExecuteMessage
//
// Purpose:
//----------------------------------------------------------------------------
// Arguments:
//----------------------------------------------------------------------------
// Return Value:
//----------------------------------------------------------------------------
virtual void ExecuteMessage();
//>---------------------------------------------------------------------------
// Function: ToString
//
// Purpose:
//----------------------------------------------------------------------------
// Arguments:
//----------------------------------------------------------------------------
// Return Value:
//----------------------------------------------------------------------------
virtual std::string ToString() const;
protected:
//>---------------------------------------------------------------------------
// Function: CloneSelf
//
// Purpose:
//----------------------------------------------------------------------------
// Arguments:
//----------------------------------------------------------------------------
// Return Value:
//----------------------------------------------------------------------------
virtual Message* CloneSelf();
//>---------------------------------------------------------------------------
// Function: FormatData
//
// Purpose:
//----------------------------------------------------------------------------
// Arguments:
//----------------------------------------------------------------------------
// Return Value:
//----------------------------------------------------------------------------
virtual void FormatData(unsigned char* pData);
//>---------------------------------------------------------------------------
// Function: ParseData
//
// Purpose:
//----------------------------------------------------------------------------
// Arguments:
//----------------------------------------------------------------------------
// Return Value:
//----------------------------------------------------------------------------
virtual void ParseData(const unsigned char* pData);
private:
// do not allow
TransferAFileCmdMessage &operator=(const TransferAFileCmdMessage &rhs);
std::string m_fromFile;
std::string m_toFile;
unsigned int m_deleteSource;
};

View File

@@ -0,0 +1,133 @@
// UNCLASSIFIED
/*-------------------------------------------------------------------------
RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION
PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS
AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO
UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO
RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS
CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS
OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON
COMPANY.
THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S.
GOVERNMENT.
UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
-------------------------------------------------------------------------*/
#include <sstream>
#include <string.h>
#include "TransferGutsVideosCmdMessage.hpp"
#include "Exception.hpp"
#include "StringUtil.hpp"
//------------------------------------------------------------------------
TransferGutsVideosCmdMessage::TransferGutsVideosCmdMessage(std::string currentTestFolder, unsigned int transferEverything, unsigned int deleteSource):
Message(MessageIDs::TRANSFER_GUTS_VIDEOS_CMD, "TRANSFER_GUTS_VIDEOS_CMD"),
m_currentTestFolder(currentTestFolder),
m_transferEverything(transferEverything),
m_deleteSource(deleteSource)
{
}
//------------------------------------------------------------------------
TransferGutsVideosCmdMessage::TransferGutsVideosCmdMessage(const TransferGutsVideosCmdMessage& copy) :
Message(copy),
m_currentTestFolder(copy.m_currentTestFolder),
m_transferEverything(copy.m_transferEverything),
m_deleteSource(copy.m_deleteSource)
{
}
//------------------------------------------------------------------------
TransferGutsVideosCmdMessage::~TransferGutsVideosCmdMessage()
{
}
//------------------------------------------------------------------------
Message* TransferGutsVideosCmdMessage::CloneSelf()
{
TransferGutsVideosCmdMessage* pMsg = new TransferGutsVideosCmdMessage(*this);
return pMsg;
}
//------------------------------------------------------------------------
void TransferGutsVideosCmdMessage::ExecuteMessage()
{
try
{
}
catch (Exception& e)
{
e.buildStackTrace(__FUNCTION_NAME__);
throw e;
}
}
//------------------------------------------------------------------------
void TransferGutsVideosCmdMessage::FormatData(unsigned char* pData)
{
// Here's how the data is formatted
// each data item is preceded by a 4-byte header which tells us the size of the data item
// 1 data item will have [header][data]
// 2 data items will have [header][data][header][data]
unsigned int dataLen = 0;
const unsigned char* pTempDataStart = pData + GetHeaderLength();
buildByteArray(&pTempDataStart, m_currentTestFolder.c_str(), m_currentTestFolder.length(), dataLen);
buildByteArray(&pTempDataStart, reinterpret_cast<char*>(&m_transferEverything), sizeof(m_transferEverything), dataLen);
buildByteArray(&pTempDataStart, reinterpret_cast<char*>(&m_deleteSource), sizeof(m_deleteSource), dataLen);
// we want update total size of the entire message
m_header.SetMessageLength(static_cast<unsigned short>(dataLen));
m_header.Format(pData);
}
//------------------------------------------------------------------------
void TransferGutsVideosCmdMessage::ParseData(const unsigned char* pData)
{
bool selfThrown = false;
const unsigned char* pTempDataStart = pData;
const unsigned char* pTempDataEnd = pData + m_header.GetMessageLength() - m_header.GetHeaderLength() - 1;
int sizeOfData = 0;
try {
// get the address of the 1st data item
sizeOfData = getNextDataItem(&pTempDataStart, pTempDataEnd, sizeOfData);
m_currentTestFolder = Util::Strings::ByteArrayToString(const_cast<unsigned char*>(pTempDataStart), sizeOfData);
sizeOfData = getNextDataItem(&pTempDataStart, pTempDataEnd, sizeOfData);
// make sure byte number match between what we're expected and what we receive
compareByteNumber(sizeof(m_transferEverything), sizeOfData);
memcpy(&m_transferEverything, pTempDataStart, sizeOfData);
sizeOfData = getNextDataItem(&pTempDataStart, pTempDataEnd, sizeOfData);
// make sure byte number match between what we're expected and what we receive
compareByteNumber(sizeof(m_deleteSource), sizeOfData);
memcpy(&m_deleteSource, pTempDataStart, sizeOfData);
} catch (Exception& e) {
if (!selfThrown)
e.buildStackTrace(__FUNCTION_NAME__);
throw e;
}
}
//------------------------------------------------------------------------
std::string TransferGutsVideosCmdMessage::ToString() const
{
std::stringstream ss;
ss << "current test folder: " << m_currentTestFolder << ". transfer everything: " << m_transferEverything << ". Delete source: " << m_deleteSource;
return ss.str();
}

View File

@@ -0,0 +1,142 @@
// UNCLASSIFIED
/*-------------------------------------------------------------------------
RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION
PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS
AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO
UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO
RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS
CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS
OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON
COMPANY.
THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S.
GOVERNMENT.
UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
-------------------------------------------------------------------------*/
#pragma once
#include "Message.hpp"
#include "MessageIDs.hpp"
#include "MessageHeader.hpp"
class TransferGutsVideosCmdMessage : public Message
{
public:
//>---------------------------------------------------------------------
// Function: TransferGutsVideosCmdMessage
//
// Purpose: constructor
//----------------------------------------------------------------------
// Arguments:
//
//----------------------------------------------------------------------
// Return Value: none
//<---------------------------------------------------------------------
TransferGutsVideosCmdMessage(std::string currentTestFolder, unsigned int transferEverything = 0, unsigned int deleteSource = 0);
//>---------------------------------------------------------------------
// Function: TransferGutsVideosCmdMessage
//
// Purpose: copy constructor
//----------------------------------------------------------------------
// Arguments:
//
//----------------------------------------------------------------------
// Return Value: none
//<---------------------------------------------------------------------
TransferGutsVideosCmdMessage(const TransferGutsVideosCmdMessage &copy);
//>---------------------------------------------------------------------
// Function: ~TransferGutsVideosCmdMessage
//
// Purpose: destructor
//----------------------------------------------------------------------
// Arguments:
//
//----------------------------------------------------------------------
// Return Value: none
//<---------------------------------------------------------------------
virtual ~TransferGutsVideosCmdMessage();
//>---------------------------------------------------------------------
// Function: ExecuteMessage
//
// Purpose:
//----------------------------------------------------------------------
// Arguments:
//
//----------------------------------------------------------------------
// Return Value: none
//<---------------------------------------------------------------------
virtual void ExecuteMessage();
//>---------------------------------------------------------------------
// Function: ToString
//
// Purpose:
//----------------------------------------------------------------------
// Arguments:
//
//----------------------------------------------------------------------
// Return Value: none
//<---------------------------------------------------------------------
virtual std::string ToString() const;
protected:
//>---------------------------------------------------------------------
// Function: CloneSelf
//
// Purpose:
//----------------------------------------------------------------------
// Arguments:
//
//----------------------------------------------------------------------
// Return Value: none
//<---------------------------------------------------------------------
virtual Message* CloneSelf();
//>---------------------------------------------------------------------
// Function: FormatData
//
// Purpose:
//----------------------------------------------------------------------
// Arguments:
//
//----------------------------------------------------------------------
// Return Value: none
//<---------------------------------------------------------------------
virtual void FormatData(unsigned char* pData);
//>---------------------------------------------------------------------
// Function: ParseData
//
// Purpose:
//----------------------------------------------------------------------
// Arguments:
//
//----------------------------------------------------------------------
// Return Value: none
//<---------------------------------------------------------------------
virtual void ParseData(const unsigned char* pData);
//>---------------------------------------------------------------------
// Function: gatherInfo
//
// Purpose:
//----------------------------------------------------------------------
// Arguments:
//
//----------------------------------------------------------------------
// Return Value: none
//<---------------------------------------------------------------------
void gatherInfo();
private:
// do not allow
TransferGutsVideosCmdMessage &operator=(const TransferGutsVideosCmdMessage &rhs);
std::string m_currentTestFolder;
unsigned int m_transferEverything;
unsigned int m_deleteSource;
};

View File

@@ -0,0 +1,88 @@
// UNCLASSIFIED
/*-------------------------------------------------------------------------
RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION
PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS
AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO
UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO
RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS
CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS
OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON
COMPANY.
THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S.
GOVERNMENT.
UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
-------------------------------------------------------------------------*/
#include <sstream>
#include <string.h>
#include "WaitForLastTaskCompletionCmdMessage.hpp"
#include "Exception.hpp"
//------------------------------------------------------------------------
WaitForLastTaskCompletionCmdMessage::WaitForLastTaskCompletionCmdMessage():
Message(MessageIDs::WAIT_FOR_COMPLETION_CMD, "WAIT_FOR_COMPLETION_CMD")
{
}
//------------------------------------------------------------------------
WaitForLastTaskCompletionCmdMessage::WaitForLastTaskCompletionCmdMessage(const WaitForLastTaskCompletionCmdMessage& copy) :
Message(copy)
{
}
//------------------------------------------------------------------------
WaitForLastTaskCompletionCmdMessage::~WaitForLastTaskCompletionCmdMessage()
{
}
//------------------------------------------------------------------------
Message* WaitForLastTaskCompletionCmdMessage::CloneSelf()
{
WaitForLastTaskCompletionCmdMessage* pMsg = new WaitForLastTaskCompletionCmdMessage(*this);
return pMsg;
}
//------------------------------------------------------------------------
void WaitForLastTaskCompletionCmdMessage::ExecuteMessage()
{
try
{
}
catch (Exception& e)
{
e.buildStackTrace(__FUNCTION_NAME__);
throw e;
}
}
//------------------------------------------------------------------------
void WaitForLastTaskCompletionCmdMessage::FormatData(unsigned char*)
{
// no data to send
}
//------------------------------------------------------------------------
void WaitForLastTaskCompletionCmdMessage::ParseData(const unsigned char*)
{
// no data to process
}
//------------------------------------------------------------------------
std::string WaitForLastTaskCompletionCmdMessage::ToString() const
{
std::stringstream ss;
ss << "";
return ss.str();
}

View File

@@ -0,0 +1,121 @@
// UNCLASSIFIED
/*-------------------------------------------------------------------------
RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION
PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS
AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO
UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO
RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS
CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS
OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON
COMPANY.
THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S.
GOVERNMENT.
UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
-------------------------------------------------------------------------*/
#pragma once
#include "Message.hpp"
#include "MessageIDs.hpp"
#include "MessageHeader.hpp"
class WaitForLastTaskCompletionCmdMessage : public Message
{
public:
//>---------------------------------------------------------------------------
// Function: WaitForLastTaskCompletionCmdMessage
//
// Purpose: constructor
//----------------------------------------------------------------------------
// Arguments:
//----------------------------------------------------------------------------
// Return Value:
//----------------------------------------------------------------------------
WaitForLastTaskCompletionCmdMessage();
//>---------------------------------------------------------------------------
// Function: WaitForLastTaskCompletionCmdMessage
//
// Purpose: copy constructor
//----------------------------------------------------------------------------
// Arguments:
//----------------------------------------------------------------------------
// Return Value:
//----------------------------------------------------------------------------
WaitForLastTaskCompletionCmdMessage(const WaitForLastTaskCompletionCmdMessage &copy);
//>---------------------------------------------------------------------------
// Function: ~WaitForLastTaskCompletionCmdMessage
//
// Purpose: destructor
//----------------------------------------------------------------------------
// Arguments:
//----------------------------------------------------------------------------
// Return Value:
//----------------------------------------------------------------------------
virtual ~WaitForLastTaskCompletionCmdMessage();
//>---------------------------------------------------------------------------
// Function: ExecuteMessage
//
// Purpose:
//----------------------------------------------------------------------------
// Arguments:
//----------------------------------------------------------------------------
// Return Value:
//----------------------------------------------------------------------------
virtual void ExecuteMessage();
//>---------------------------------------------------------------------------
// Function: ToString
//
// Purpose:
//----------------------------------------------------------------------------
// Arguments:
//----------------------------------------------------------------------------
// Return Value:
//----------------------------------------------------------------------------
virtual std::string ToString() const;
// indicate command executed successfully or not
static bool s_commandCompletionSuccess;
protected:
//>---------------------------------------------------------------------------
// Function: CloneSelf
//
// Purpose:
//----------------------------------------------------------------------------
// Arguments:
//----------------------------------------------------------------------------
// Return Value:
//----------------------------------------------------------------------------
virtual Message* CloneSelf();
//>---------------------------------------------------------------------------
// Function: FormatData
//
// Purpose:
//----------------------------------------------------------------------------
// Arguments:
//----------------------------------------------------------------------------
// Return Value:
//----------------------------------------------------------------------------
virtual void FormatData(unsigned char* pData);
//>---------------------------------------------------------------------------
// Function: ParseData
//
// Purpose:
//----------------------------------------------------------------------------
// Arguments:
//----------------------------------------------------------------------------
// Return Value:
//----------------------------------------------------------------------------
virtual void ParseData(const unsigned char* pData);
private:
// do not allow
WaitForLastTaskCompletionCmdMessage &operator=(const WaitForLastTaskCompletionCmdMessage &rhs);
};

View File

@@ -0,0 +1,27 @@
//>>********************************************************************
// UNCLASSIFIED
//
// COPYRIGHT 2020 RAYTHEON COMPANY
//
// DESCRIPTION
// Class to be exported from this DLL for use in other assemblies
//
// $Revision: 1 $
//
// REVISION HISTORY
//
// 1 4/23/2020 Duc Le
// - initial checkin
//<<********************************************************************
#include "Constants.hpp"
//-----------------------------------------------------------------------------
std::map<Constants::RemoteHosts, std::string> Constants::EtbComputerNameMapping::computerMap = Constants::EtbComputerNameMapping::createMap();
std::map<Constants::RemoteHosts, std::string> Constants::KwCilComputerNameMapping::computerMap = Constants::KwCilComputerNameMapping::createMap();
std::map<Constants::ConfigSections, std::string> Constants::ConfigSectionNameMapping::sectionMap = Constants::ConfigSectionNameMapping::createMap();
std::map<Constants::RemoteHosts, Constants::ConfigSections> Constants::ConfigSectionToComputerKeyMapping::sectionToKeyMap = Constants::ConfigSectionToComputerKeyMapping::createMap();
//-----------------------------------------------------------------------------

View File

@@ -0,0 +1,104 @@
#pragma once
#include <string>
#include <map>
namespace Constants
{
enum class TestPlatforms
{
ETB,
KWCIL,
NUM_PLATFORMS
};
enum class RemoteHosts
{
VIDEO_PC,
SWDEV_PC,
SIXDOF_PC,
ASGEXEC_PC,
ASG_OGEN1_PC,
ASG_OGEN2_PC,
ASG_OGEN3_PC,
NUM_REMOTE_HOSTS
};
enum class ConfigSections
{
VIDEO_PC,
SWDEV_PC,
SIXDOF_PC,
ASG_PC,
NUM_CONFIG_SECTIONS
};
struct EtbComputerNameMapping
{
static std::map<RemoteHosts, std::string> createMap()
{
std::map<RemoteHosts, std::string> map{
{RemoteHosts::SWDEV_PC, "GUCC_COMPUTER"},
{RemoteHosts::SIXDOF_PC, "GUCC_COMPUTER"},
{RemoteHosts::ASGEXEC_PC, "GUCC_EXEC_COMPUTER"},
{RemoteHosts::ASG_OGEN1_PC, "GUCC_OGENA_COMPUTER"},
};
return map;
}
static std::map<RemoteHosts, std::string> computerMap;
};
struct KwCilComputerNameMapping
{
static std::map<RemoteHosts, std::string> createMap()
{
std::map<RemoteHosts, std::string> map{
{RemoteHosts::SWDEV_PC, "KWCC3_COMPUTER"},
{RemoteHosts::SIXDOF_PC, "KWCC3_COMPUTER"},
{RemoteHosts::ASGEXEC_PC, "KWCC3_EXEC_COMPUTER"},
{RemoteHosts::ASG_OGEN1_PC, "KWCC3_OGENA_COMPUTER"},
{RemoteHosts::ASG_OGEN2_PC, "KWCC3_OGENB_COMPUTER"},
{RemoteHosts::ASG_OGEN3_PC, "KWCC3_OGENC_COMPUTER"},
};
return map;
}
static std::map<RemoteHosts, std::string> computerMap;
};
struct ConfigSectionNameMapping
{
static std::map<ConfigSections, std::string> createMap()
{
std::map<ConfigSections, std::string> map{
{ConfigSections::SWDEV_PC, "SWDEV_PC"},
{ConfigSections::SIXDOF_PC, "SIXDOF_PC"},
{ConfigSections::ASG_PC, "ASG_PC"}
};
return map;
}
static std::map<ConfigSections, std::string> sectionMap;
};
struct ConfigSectionToComputerKeyMapping
{
static std::map<RemoteHosts, ConfigSections> createMap()
{
std::map<RemoteHosts, ConfigSections> map{
{RemoteHosts::SWDEV_PC, ConfigSections::SWDEV_PC},
{RemoteHosts::SIXDOF_PC, ConfigSections::SIXDOF_PC},
{RemoteHosts::ASGEXEC_PC, ConfigSections::ASG_PC},
{RemoteHosts::ASG_OGEN1_PC, ConfigSections::ASG_PC},
{RemoteHosts::ASG_OGEN2_PC, ConfigSections::ASG_PC},
{RemoteHosts::ASG_OGEN3_PC, ConfigSections::ASG_PC}
};
return map;
}
static std::map<RemoteHosts, ConfigSections> sectionToKeyMap;
};
}

View File

@@ -0,0 +1,56 @@
// UNCLASSIFIED
/*-------------------------------------------------------------------------
RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION
PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS
AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO
UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO
RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS
CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS
OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON
COMPANY.
THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S.
GOVERNMENT.
UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
-------------------------------------------------------------------------*/
#include <sstream>
#include "EventNames.hpp"
#include "Exception.hpp"
EventNames& EventNames::Instance()
{
static EventNames names;
return names;
}
//------------------------------------------------------------------------
EventNames::~EventNames()
{
}
//------------------------------------------------------------------------
EventNames::EventNames():
m_nameMap()
{
m_nameMap[GLOBAL_QUIT] = "GLOBAL_QUIT";
m_nameMap[HWIL_QUIT_UDP_READ_EVENT] = "HWIL_QUIT_UDP_READ_EVENT";
}
//------------------------------------------------------------------------
std::string EventNames::operator[](EventNames::Names name)
{
std::map<Names, std::string>::const_iterator it = m_nameMap.find(name);
if (it == m_nameMap.end())
{
std::stringstream ss;
ss << "value " << name << " not found";
throw Exception(__FUNCTION_NAME__,ss.str());
}
return it->second;
}

View File

@@ -0,0 +1,44 @@
// UNCLASSIFIED
/*-------------------------------------------------------------------------
RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION
PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS
AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO
UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO
RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS
CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS
OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON
COMPANY.
THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S.
GOVERNMENT.
UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
-------------------------------------------------------------------------*/
#pragma once
#include <map>
#include <string>
class EventNames
{
public:
static EventNames& Instance();
virtual ~EventNames();
enum Names
{
GLOBAL_QUIT,
HWIL_QUIT_UDP_READ_EVENT,
NUM_EVENTS
};
std::string operator[](EventNames::Names name);
private:
// do not allow
EventNames(const EventNames &rhs);
EventNames& operator=(const EventNames& rhs) {};
EventNames();
std::map<EventNames::Names, std::string> m_nameMap;
};

View File

@@ -0,0 +1,221 @@
//>>********************************************************************
// UNCLASSIFIED
//
// COPYRIGHT 2020 RAYTHEON COMPANY
//
// DESCRIPTION
// Class to be exported from this DLL for use in other assemblies
//
// $Revision: 1 $
//
// REVISION HISTORY
//
// 1 4/23/2020 Duc Le
// - initial checkin
//<<********************************************************************
#include "HwilClient.hpp"
#include "HwilUdpSocket.hpp"
#include "Exception.hpp"
#include "AutomationMsgParser.hpp"
#include "Message.hpp"
#include "GenericRspMessage.hpp"
#include "KwScenarioStarted.hpp"
#include "KwScenarioStopped.hpp"
#include "WaitForLastTaskCompletionCmdMessage.hpp"
#include "WinProc.hpp"
#include "IniFile.hpp"
#include "Timestamp.hpp"
#include "FileSystemUtil.hpp"
#include <sstream>
#include <iomanip>
//-----------------------------------------------------------------------------
HwilClient* HwilClient::instance()
{
static HwilClient* pClient = 0;
try
{
if (pClient == 0)
{
pClient = new HwilClient();
}
}
catch (Exception& ex)
{
ex.buildStackTrace(__FUNCTION_NAME__);
throw ex;
}
return pClient;
}
//-----------------------------------------------------------------------------
HwilClient::HwilClient():
pUdpSocket_(0)
{
try
{
pUdpSocket_ = new HwilUdpSocket();
}
catch (Exception& ex)
{
ex.buildStackTrace(__FUNCTION_NAME__);
throw ex;
}
}
//-----------------------------------------------------------------------------
HwilClient::~HwilClient()
{
if (pUdpSocket_ != 0)
delete pUdpSocket_;
}
//-----------------------------------------------------------------------------
void HwilClient::startingScenario(Constants::RemoteHosts remoteHost)
{
try
{
KwScenarioStarted cmd;
GenericRspMessage rsp(false);
SendCommandGetResponse(remoteHost, &cmd, &rsp);
if (!rsp.GetSuccessfulFlag())
{
throw Exception(__FUNCTION_NAME__, "Command failed to execute");
}
}
catch (Exception & ex)
{
ex.buildStackTrace(__FUNCTION_NAME__);
throw ex;
}
}
//-----------------------------------------------------------------------------
void HwilClient::endingScenario(Constants::RemoteHosts remoteHost)
{
try
{
bool createFolderSuccess = false;
Timestamp ts;
std::string basePath = WinProc::Instance().getConfig().getString("GENERAL", "BASE_TEST_DATA_PATH");
std::string relPath = "";
int runCount = 1;
std::stringstream testFolder;
std::string path = "";
std::string date;
std::string time;
ts.GetCurrentDateTimeString(date, time, Timestamp::DateFormat::YYYYMM, Timestamp::TimeFormat::HHMMSS, "_");
while (1)
{
testFolder.clear();
testFolder.str("");
testFolder << "run_" << std::setfill('0') << std::setw(3) << runCount++;
relPath = Util::FileSystem::BuildPath(date, testFolder.str());
path = Util::FileSystem::BuildPath(basePath, relPath);
if (!Util::FileSystem::IsDirectory(path))
{
createFolderSuccess = Util::FileSystem::CreateFolder(path.c_str());
break;
}
}
if (createFolderSuccess)
{
KwScenarioStopped cmd(relPath);
GenericRspMessage rsp(false);
SendCommandGetResponse(remoteHost, &cmd, &rsp);
if (!rsp.GetSuccessfulFlag())
{
throw Exception(__FUNCTION_NAME__, "Command failed to execute");
}
}
}
catch (Exception& ex)
{
ex.buildStackTrace(__FUNCTION_NAME__);
throw ex;
}
}
//-----------------------------------------------------------------------------
void HwilClient::waitForCompletion(Constants::RemoteHosts remoteHost, unsigned long timeoutMs)
{
try
{
WaitForLastTaskCompletionCmdMessage cmd;
GenericRspMessage rsp(false);
SendCommandGetResponse(remoteHost, &cmd, &rsp, timeoutMs);
if (!rsp.GetSuccessfulFlag())
{
throw Exception(__FUNCTION_NAME__, "Command failed to execute");
}
}
catch (Exception & ex)
{
ex.buildStackTrace(__FUNCTION_NAME__);
throw ex;
}
}
//-----------------------------------------------------------------------------
void HwilClient::SendCommandGetResponse(Constants::RemoteHosts remoteHost, Message* commandMsg, Message* rspMsg, unsigned long timeoutInMs)
{
std::stringstream ss;
try
{
// just need a buffer big enough for outgoing commands
const unsigned int BUF_SIZE = 1024;
unsigned char data[BUF_SIZE];
commandMsg->Format(data);
pUdpSocket_->write(remoteHost, data, commandMsg->GetEntireMessageLength());
unsigned int numBytesRead = 0;
unsigned char* data2;
pUdpSocket_->read(&data2, numBytesRead, timeoutInMs);
unsigned int msgId = 0;
AutomationMsgParser::instance().parseMsg(data2, numBytesRead, &msgId);
if (msgId != rspMsg->GetMessageID())
{
ss << "Expected MSG ID: " << rspMsg << ". Received MSG ID: " << msgId;
throw Exception(__FUNCTION_NAME__, ss.str());
}
rspMsg->Parse(data2);
}
catch (Exception & ex)
{
ex.buildStackTrace(__FUNCTION_NAME__);
throw ex;
}
}

View File

@@ -0,0 +1,125 @@
//>>********************************************************************
// UNCLASSIFIED
//
// COPYRIGHT 2020 RAYTHEON COMPANY
//
// DESCRIPTION
// Class to be exported from this DLL for use in other assemblies
//
// $Revision: 1 $
//
// REVISION HISTORY
//
// 1 4/23/2020 Duc Le
// - initial checkin
//<<********************************************************************
#if !defined(HWILCLIENT_HPP)
#define HWILCLIENT_HPP
#include <string>
#include <vector>
#include "Constants.hpp"
class HwilUdpSocket;
class Message;
class HwilClient
{
public:
//>-------------------------------------------------------------------------
// Function: instance
//
// Purpose: make this class a singleton
//--------------------------------------------------------------------------
// Arguments:
// remoteAddress -
// remotePort -
// localPort -
// bufferSizeInBytes -
// errorLogFileName - error log file
//--------------------------------------------------------------------------
// Return Value: pointer to object
//<-------------------------------------------------------------------------
static HwilClient* instance();
//>-------------------------------------------------------------------------
// Function: HwilClient
//
// Purpose: destructor
//--------------------------------------------------------------------------
// Arguments:
//--------------------------------------------------------------------------
// Return Value: none
//<-------------------------------------------------------------------------
~HwilClient();
//>-------------------------------------------------------------------------
// Function: startingScenario
//
// Purpose:
//--------------------------------------------------------------------------
// Arguments: none
//--------------------------------------------------------------------------
// Return Value: none
//<-------------------------------------------------------------------------
void startingScenario(Constants::RemoteHosts remoteHost);
//>-------------------------------------------------------------------------
// Function: endingScenario
//
// Purpose:
//--------------------------------------------------------------------------
// Arguments: none
//--------------------------------------------------------------------------
// Return Value: none
//<-------------------------------------------------------------------------
void endingScenario(Constants::RemoteHosts remoteHost);
//>-------------------------------------------------------------------------
// Function: waitForCompletion
//
// Purpose:
//--------------------------------------------------------------------------
// Arguments: none
//--------------------------------------------------------------------------
// Return Value: none
//<-------------------------------------------------------------------------
void waitForCompletion(Constants::RemoteHosts remoteHost, unsigned long timeoutMs = 0xFFFFFFFF);
private:
//>-------------------------------------------------------------------------
// Function: HwilClient
//
// Purpose: constructor
//--------------------------------------------------------------------------
// Arguments:
// remoteAddress -
// remotePort -
// localPort -
// bufferSizeInBytes -
// errorLogFileName - error log file
//--------------------------------------------------------------------------
// Return Value: none
//<-------------------------------------------------------------------------
HwilClient();
//>-------------------------------------------------------------------------
// Function: SendCommandGetResponse
//
// Purpose:
//--------------------------------------------------------------------------
// Arguments: none
//--------------------------------------------------------------------------
// Return Value: none
//<-------------------------------------------------------------------------
void SendCommandGetResponse(Constants::RemoteHosts remoteHost, Message* commandMsg, Message* rspMsg, unsigned long timeoutInMs = 1000);
// do not allow
HwilClient(const HwilClient& copy);
HwilClient& operator=(const HwilClient& rhs) { return *this; };
HwilUdpSocket* pUdpSocket_;
};
#endif //#if !defined(HWILCLIENT_HPP)

View File

@@ -0,0 +1,338 @@
//>>********************************************************************
// UNCLASSIFIED
//
// COPYRIGHT 2020 RAYTHEON COMPANY
//
// DESCRIPTION
// Class to be exported from this DLL for use in other assemblies
//
// $Revision: 1 $
//
// REVISION HISTORY
//
// 1 4/23/2020 Duc Le
// - initial checkin
//<<********************************************************************
#include "HwilUdpSocket.hpp"
#include "Exception.hpp"
#include "Constants.hpp"
#include "WinProc.hpp"
#include "IniFile.hpp"
#include "EventNames.hpp"
#include "NTEvent.hpp"
#include "NetworkUtil.hpp"
#include <winsock2.h> // always make sure this is placed before any <windows.h> include
#include <ws2tcpip.h>
#include <algorithm>
#include <sstream>
#include <regex>
//-----------------------------------------------------------------------------
HwilUdpSocket::HwilUdpSocket() :
socket_(INVALID_SOCKET),
timeOutWaitingForOverlappedEvent_(false)
{
try
{
for (int i = 0; i < static_cast<int>(Constants::RemoteHosts::NUM_REMOTE_HOSTS); i++)
{
memset(reinterpret_cast<char*>(&remoteSockInfo_[i]), 0, sizeof(remoteSockInfo_[i]));
}
WSADATA wsa;
WORD version = MAKEWORD(2, 2);
if (WSAStartup(version, &wsa) != 0)
{
throw Exception(__FUNCTION_NAME__, "WSAStartup() failed");
}
setupSocket();
int remotePort = WinProc::Instance().getConfig().getLong("GENERAL", "HWIL_UDP_REMOTE_PORT");
std::map<Constants::RemoteHosts, std::string>::iterator it;
std::map<Constants::RemoteHosts, std::string> computerMap = WinProc::Instance().getComputerMap();
for (it = computerMap.begin(); it != computerMap.end(); it++)
{
std::string section = Constants::ConfigSectionNameMapping::sectionMap[Constants::ConfigSectionToComputerKeyMapping::sectionToKeyMap[it->first]];
std::string remoteHostAddress = WinProc::Instance().getConfig().getString(section, it->second);
remoteSockInfo_[static_cast<unsigned int>(it->first)].sin_family = AF_INET;
try
{
inet_pton(remoteSockInfo_[static_cast<unsigned int>(it->first)].sin_family, convertHostnameToIp(remoteHostAddress).c_str(), &(remoteSockInfo_[static_cast<unsigned int>(it->first)].sin_addr));
remoteSockInfo_[static_cast<unsigned int>(it->first)].sin_port = htons(remotePort);
}
catch (Exception&)
{ }
}
::ZeroMemory(&readOverlapped_, sizeof(WSAOVERLAPPED));
readOverlapped_.hEvent = WSACreateEvent();
readBuffer_.len = BUF_SIZE;
readBuffer_.buf = data_;
}
catch (Exception& ex)
{
ex.buildStackTrace(__FUNCTION_NAME__);
throw;
}
}
//-----------------------------------------------------------------------------
HwilUdpSocket::~HwilUdpSocket()
{
if (socket_ != INVALID_SOCKET)
closesocket(socket_);
}
//-----------------------------------------------------------------------------
void HwilUdpSocket::setupSocket()
{
try
{
if ((socket_ = socket(AF_INET, SOCK_DGRAM, 0)) == INVALID_SOCKET)
{
throw Exception(__FUNCTION_NAME__, "socket() failed");
}
localPort_ = WinProc::Instance().getConfig().getLong("GENERAL", "HWIL_UDP_LOCAL_PORT");
localSockInfo_.sin_family = AF_INET;
localSockInfo_.sin_addr.s_addr = INADDR_ANY;
localSockInfo_.sin_port = htons(localPort_);
int set_option_on = 1;
// configure the socket to be bind to ip and port even if another process has already bound to the same ip and port
setsockopt(socket_, SOL_SOCKET, SO_REUSEADDR, (char*)&set_option_on, sizeof(set_option_on));
//Bind
if (bind(socket_, reinterpret_cast<struct sockaddr*>(&localSockInfo_), sizeof(localSockInfo_)) == SOCKET_ERROR)
{
throw Exception(__FUNCTION_NAME__, "bind() failed");
}
}
catch (Exception & ex)
{
ex.buildStackTrace(__FUNCTION_NAME__);
throw;
}
}
//-----------------------------------------------------------------------------
std::string HwilUdpSocket::convertHostnameToIp(std::string hostname)
{
std::string ip = hostname;
// convert to dot address notation if needed
if (hostname.length() > 0 && !Util::Network::IsIpAddress(hostname))
{
struct addrinfo hints = {}, * addrInfo;
char port_str[16] = {};
hints.ai_family = AF_INET;
hints.ai_socktype = SOCK_STREAM;
hints.ai_protocol = IPPROTO_TCP;
int dwRetval = getaddrinfo(hostname.c_str(), port_str, &hints, &addrInfo);
if (dwRetval != 0)
{
std::stringstream ss;
ss << "getaddrinfo() failed with error : " << WSAGetLastError();
throw Exception(__FUNCTION_NAME__, ss.str());
}
struct sockaddr_in* ipv = (struct sockaddr_in*)addrInfo->ai_addr;
struct in_addr* addr = &(ipv->sin_addr);
char ipstr[INET_ADDRSTRLEN];
inet_ntop(addrInfo->ai_family, addr, ipstr, sizeof(ipstr));
ip = std::string(ipstr);
}
return ip;
}
//-----------------------------------------------------------------------------
void HwilUdpSocket::write(Constants::RemoteHosts host, unsigned char* pWriteBuf, unsigned int numBytes)
{
try
{
write(host, reinterpret_cast<char*>(pWriteBuf), numBytes);
}
catch (Exception& e)
{
e.buildStackTrace(__FUNCTION_NAME__);
throw;
}
}
//-----------------------------------------------------------------------------
void HwilUdpSocket::write(Constants::RemoteHosts host, char* pWriteBuf, unsigned int numBytes)
{
try
{
if (remoteSockInfo_[static_cast<unsigned int>(host)].sin_addr.S_un.S_addr == 0)
{
std::string section = Constants::ConfigSectionNameMapping::sectionMap[Constants::ConfigSectionToComputerKeyMapping::sectionToKeyMap[host]];
std::string remoteHostAddress = WinProc::Instance().getConfig().getString(section, WinProc::Instance().getComputerMap()[host]);
throw Exception(__FUNCTION_NAME__, remoteHostAddress + " not available");
}
if (::sendto(socket_, pWriteBuf, numBytes, 0, (struct sockaddr*)&remoteSockInfo_[static_cast<unsigned int>(host)], sizeof(remoteSockInfo_[static_cast<unsigned int>(host)])) == SOCKET_ERROR)
{
throw Exception(__FUNCTION_NAME__, "sendto() failed");
}
}
catch (Exception& e)
{
e.buildStackTrace(__FUNCTION_NAME__);
throw;
}
}
//-----------------------------------------------------------------------------
void HwilUdpSocket::read(unsigned char** pReadBuf, unsigned int& numBytesRead, DWORD readTimeOutMs)
{
try
{
read(reinterpret_cast<char**>(pReadBuf), numBytesRead, readTimeOutMs);
}
catch (Exception& e)
{
e.buildStackTrace(__FUNCTION_NAME__);
throw;
}
}
//-----------------------------------------------------------------------------
void HwilUdpSocket::read(char** pReadBuf, unsigned int& numBytesRead, DWORD readTimeOutMs)
{
enum
{
QUIT_READING,
READ_EVENT,
NUM_EVENT
};
HANDLE handles[NUM_EVENT];
try
{
handles[QUIT_READING] = WinProc::Instance().getEvent(EventNames::HWIL_QUIT_UDP_READ_EVENT).getHandle();
handles[READ_EVENT] = readOverlapped_.hEvent;
DWORD BytesRecvd = 0;
DWORD flags = 0;
int ret1;
int err;
DWORD ret2 = 0;
if (timeOutWaitingForOverlappedEvent_)
{
ret1 = SOCKET_ERROR;
err = WSA_IO_PENDING;
timeOutWaitingForOverlappedEvent_ = false;
}
else
{
WSAResetEvent(readOverlapped_.hEvent);
ret1 = ::WSARecv(socket_,
&readBuffer_,
1,
&BytesRecvd,
&flags,
&readOverlapped_,
NULL);
err = ::WSAGetLastError();
}
if (ret1 == SOCKET_ERROR)
{
switch (err)
{
case WSAEINVAL:
case WSA_IO_PENDING:
ret2 = ::WaitForMultipleObjects(NUM_EVENT, handles, false, readTimeOutMs);
if (ret2 == WAIT_TIMEOUT)
{
timeOutWaitingForOverlappedEvent_ = true;
throw Exception(__FUNCTION_NAME__, "WaitForMultipleObjects() timed out");
}
else if ((ret2 - WAIT_OBJECT_0) == READ_EVENT)
{
if (!::WSAGetOverlappedResult(socket_,
&readOverlapped_,
&BytesRecvd,
FALSE,
&flags))
{
int resultErr = ::WSAGetLastError();
switch (resultErr)
{
case WSA_OPERATION_ABORTED:
read(pReadBuf, numBytesRead, readTimeOutMs);
break;
case WSAECONNRESET:
case WSAECONNABORTED: // intentional fall-through
//setConnectionMade(false);
throw Exception(__FUNCTION_NAME__, "force closed");
break;
default:
break;
}
}
}
else if ((ret2 - WAIT_OBJECT_0) == QUIT_READING)
{
return;
}
break;
case WSAECONNRESET:
case WSAENOTSOCK: // intentional fall-through
case WSAENOTCONN:
case WSAENOBUFS:
throw Exception(__FUNCTION_NAME__, "connection closed");
case WSAEMSGSIZE:
throw Exception(__FUNCTION_NAME__, "Receive Buffer is not large enough");
break;
case WSA_OPERATION_ABORTED: // fall through for now
break;
}
}
numBytesRead = BytesRecvd;
*pReadBuf = data_;
}
catch (Exception & ex)
{
ex.buildStackTrace(__FUNCTION_NAME__);
throw;
}
}

View File

@@ -0,0 +1,145 @@
//>>********************************************************************
// UNCLASSIFIED
//
// COPYRIGHT 2020 RAYTHEON COMPANY
//
// DESCRIPTION
// Class to be exported from this DLL for use in other assemblies
//
// $Revision: 1 $
//
// REVISION HISTORY
//
// 1 4/23/2020 Duc Le
// - initial checkin
//<<********************************************************************
#if !defined(HWILUDPSOCKET_HPP)
#define HWILUDPSOCKET_HPP
#include <winsock2.h>
#include <ws2tcpip.h>
#include <string>
#include <vector>
#include "Constants.hpp"
class HwilUdpSocket
{
public:
//>-------------------------------------------------------------------------
// Function: HwilUdpSocket
//
// Purpose: constructor
//--------------------------------------------------------------------------
// Arguments:
// remoteAddress -
// remotePort -
// localPort -
// bufferSizeInBytes -
// errorLogFileName - error log file
//--------------------------------------------------------------------------
// Return Value: none
//<-------------------------------------------------------------------------
HwilUdpSocket();
//>-------------------------------------------------------------------------
// Function: HwilUdpSocket
//
// Purpose: destructor
//--------------------------------------------------------------------------
// Arguments:
//--------------------------------------------------------------------------
// Return Value: none
//<-------------------------------------------------------------------------
~HwilUdpSocket();
//>-------------------------------------------------------------------------
// Function: write
//
// Purpose:
//--------------------------------------------------------------------------
// Arguments: none
//--------------------------------------------------------------------------
// Return Value: none
//<-------------------------------------------------------------------------
void write(Constants::RemoteHosts host, char* pWriteBuf, unsigned int numBytes);
//>-------------------------------------------------------------------------
// Function: write
//
// Purpose:
//--------------------------------------------------------------------------
// Arguments: none
//--------------------------------------------------------------------------
// Return Value: none
//<-------------------------------------------------------------------------
void write(Constants::RemoteHosts host, unsigned char* pWriteBuf, unsigned int numBytes);
//>-------------------------------------------------------------------------
// Function: read
//
// Purpose:
//--------------------------------------------------------------------------
// Arguments: none
//--------------------------------------------------------------------------
// Return Value: none
//<-------------------------------------------------------------------------
void read(char** pReadBuf, unsigned int& numBytesRead, DWORD readTimeOutMs = ULONG_MAX);
//>-------------------------------------------------------------------------
// Function: read
//
// Purpose:
//--------------------------------------------------------------------------
// Arguments: none
//--------------------------------------------------------------------------
// Return Value: none
//<-------------------------------------------------------------------------
void read(unsigned char** pReadBuf, unsigned int& numBytesRead, DWORD readTimeOutMs = ULONG_MAX);
protected:
//>-------------------------------------------------------------------------
// Function: setupSocket
//
// Purpose:
//--------------------------------------------------------------------------
// Arguments: none
//--------------------------------------------------------------------------
// Return Value: none
//<-------------------------------------------------------------------------
void setupSocket();
//>-------------------------------------------------------------------------
// Function: convertHostnameToIp
//
// Purpose:
//--------------------------------------------------------------------------
// Arguments: none
//--------------------------------------------------------------------------
// Return Value: none
//<-------------------------------------------------------------------------
std::string convertHostnameToIp(std::string hostname);
private:
static const unsigned int BUF_SIZE = 1024;
// do not allow
HwilUdpSocket(const HwilUdpSocket& copy);
HwilUdpSocket& operator=(const HwilUdpSocket& rhs) {};
std::string remoteAddress_;
int remotePort_;
int localPort_;
SOCKET socket_;
struct sockaddr_in localSockInfo_;
struct sockaddr_in remoteSockInfo_[static_cast<unsigned int>(Constants::RemoteHosts::NUM_REMOTE_HOSTS)];
WSABUF readBuffer_;
WSAOVERLAPPED readOverlapped_;
bool timeOutWaitingForOverlappedEvent_;
char data_[BUF_SIZE];
};
#endif

View File

@@ -0,0 +1,96 @@
// UNCLASSIFIED
/*-------------------------------------------------------------------------
RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION
PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS
AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO
UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO
RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS
CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS
OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON
COMPANY.
THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S.
GOVERNMENT.
UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
-------------------------------------------------------------------------*/
#include "WinProc.hpp"
#include "Exception.hpp"
#include "IniFile.hpp"
#include "Timestamp.hpp"
#include "ErrorLog.hpp"
#include "FileSystemUtil.hpp"
#include "Constants.hpp"
#include "MiscUtil.hpp"
#include <sstream>
#include <regex>
//-----------------------------------------------------------------------------
WinProc& WinProc::Instance()
{
static WinProc proc;
return proc;
}
//-----------------------------------------------------------------------------
WinProc::WinProc() :
Proc()
{
// all singleton classes aka [class]::instance() need to be instantiated here as they create static variables
// they all should also be instantiated in one thread, preferable the main thread. Instantiating them in multiple
// threads will make it hard for us to synchronize their destructions, as static variables are destroyed in the order
// they were created per thread
// all static variables are destroyed in the reverse order they were created per thread
// so any static variables that are dependent upon need to be instantiated first so they will be destroyed last
// WinProc is the last static variables to be instantiated and the first static variable to be destroyed
// as it needs to coordinate the destruction of all variables created on the heap
try {
std::string exePath = Util::FileSystem::ExtractDirectory(Util::FileSystem::GetExePathAndFilename().c_str());
std::string configFilePath = Util::FileSystem::BuildPath(exePath, "config.ini");
m_iniFile = new IniFile(configFilePath);
m_computerMap = Constants::KwCilComputerNameMapping::computerMap;
std::string etbRegexPattern = m_iniFile->getString("GENERAL", "ETB_REGEX_PATTERN");
std::string computerName = Util::Misc::GetComputerName();
// is ETB
if (std::regex_match(computerName, std::regex(etbRegexPattern, std::regex_constants::icase)))
{
m_computerMap = Constants::EtbComputerNameMapping::computerMap;
}
std::string logPath = Util::FileSystem::BuildPath(exePath, "Output");
Util::FileSystem::CreateFolder(logPath);
Util::FileSystem::CleanUpLogs(logPath, ".+\\.txt");
std::stringstream ss;
std::string date;
std::string time;
Timestamp::GetCurrentDateTimeString(date, time, Timestamp::DateFormat::YYYYMMDD, Timestamp::TimeFormat::HHMMSS, "_");
ss << date << "_" << time << "_log.txt";
ErrorLog::Instance(Util::FileSystem::BuildPath(logPath, ss.str()));
}
catch (Exception& e) {
e.buildStackTrace(__FUNCTION_NAME__);
throw;
}
}
//-----------------------------------------------------------------------------
WinProc::~WinProc()
{
}

View File

@@ -0,0 +1,88 @@
// UNCLASSIFIED
/*-------------------------------------------------------------------------
RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION
PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS
AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO
UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO
RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS
CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS
OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON
COMPANY.
THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S.
GOVERNMENT.
UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
-------------------------------------------------------------------------*/
#ifndef LINUXPROC_H
#define LINUXPROC_H
#include "Proc.hpp"
#include "Constants.hpp"
class IniFile;
class WinProc : public Proc
{
public:
//>---------------------------------------------------------------------------
// Function: instance
//
// Purpose: singleton
//----------------------------------------------------------------------------
// Arguments:
//----------------------------------------------------------------------------
// Return Value:
//----------------------------------------------------------------------------
static WinProc& Instance();
//>---------------------------------------------------------------------------
// Function: getConfig
//
// Purpose:
//----------------------------------------------------------------------------
// Arguments:
//----------------------------------------------------------------------------
// Return Value:
//----------------------------------------------------------------------------
IniFile& getConfig(){return *m_iniFile;};
//>---------------------------------------------------------------------------
// Function: ~Proc
//
// Purpose: Destroyer
//----------------------------------------------------------------------------
// Arguments:
//----------------------------------------------------------------------------
// Return Value:
//----------------------------------------------------------------------------
~WinProc();
//>---------------------------------------------------------------------------
// Function: getComputerMap
//
// Purpose:
//----------------------------------------------------------------------------
// Arguments:
//----------------------------------------------------------------------------
// Return Value:
std::map<Constants::RemoteHosts, std::string> getComputerMap() { return m_computerMap; }
private:
//>---------------------------------------------------------------------------
// Function: Proc
//
// Purpose: Ctor
//----------------------------------------------------------------------------
// Arguments:
//----------------------------------------------------------------------------
// Return Value:
//----------------------------------------------------------------------------
WinProc();
IniFile* m_iniFile;
std::map<Constants::RemoteHosts, std::string> m_computerMap;
};
#endif