Svc/ComLogger component completed

This commit is contained in:
Josh Weadick 2021-06-11 17:32:57 -07:00
parent 0716fa646f
commit c32493b5c7
10 changed files with 215 additions and 35 deletions

View File

@ -0,0 +1,31 @@
module Svc {
active component ComLogger {
@ FPP from XML: original path was Svc/ComLogger/Commands.xml
include "Commands.fppi"
@ FPP from XML: original path was Svc/ComLogger/Events.xml
include "Events.fppi"
async input port comIn: [1] Fw.Com
time get port timeCaller
command reg port cmdRegOut
command recv port cmdIn
event port logOut
command resp port cmdResponseOut
async input port pingIn: [1] Svc.Ping
output port pingOut: [1] Svc.Ping
text event port LogText
}
}

View File

@ -1,43 +1,119 @@
<?xml version="1.0" encoding="UTF-8"?>
<component name="ComLogger" kind="active" namespace="Svc" modeler="true">
<!-- =====================================================================
ComLoggerComponentAi.xml
Generated by fpp-to-xml
====================================================================== -->
<component namespace="Svc" name="ComLogger" kind="active">
<import_port_type>Fw/Com/ComPortAi.xml</import_port_type>
<import_port_type>Fw/Time/TimePortAi.xml</import_port_type>
<import_port_type>Fw/Cmd/CmdRegPortAi.xml</import_port_type>
<import_port_type>Fw/Cmd/CmdPortAi.xml</import_port_type>
<import_port_type>Fw/Log/LogPortAi.xml</import_port_type>
<import_port_type>Fw/Cmd/CmdResponsePortAi.xml</import_port_type>
<import_port_type>Svc/Ping/PingPortAi.xml</import_port_type>
<import_dictionary>Svc/ComLogger/Commands.xml</import_dictionary>
<import_dictionary>Svc/ComLogger/Events.xml</import_dictionary>
<import_port_type>Fw/Cmd/CmdPortAi.xml</import_port_type>
<import_port_type>Fw/Cmd/CmdRegPortAi.xml</import_port_type>
<import_port_type>Fw/Cmd/CmdResponsePortAi.xml</import_port_type>
<import_port_type>Fw/Com/ComPortAi.xml</import_port_type>
<import_port_type>Fw/Log/LogPortAi.xml</import_port_type>
<import_port_type>Fw/Log/LogTextPortAi.xml</import_port_type>
<import_port_type>Fw/Time/TimePortAi.xml</import_port_type>
<import_port_type>Svc/Ping/PingPortAi.xml</import_port_type>
<ports>
<ports>
<port name="LogText" data_type="Fw::LogText" kind="output" role="LogTextEvent" max_number="1"/>
<port name="cmdIn" data_type="Fw::Cmd" kind="input" role="Cmd" max_number="1"/>
<port name="cmdRegOut" data_type="Fw::CmdReg" kind="output" role="CmdRegistration" max_number="1"/>
<port name="cmdResponseOut" data_type="Fw::CmdResponse" kind="output" role="CmdResponse" max_number="1"/>
<port name="comIn" data_type="Fw::Com" kind="async_input" max_number="1" full="assert"/>
<port name="logOut" data_type="Fw::Log" kind="output" role="LogEvent" max_number="1"/>
<port name="pingIn" data_type="Svc::Ping" kind="async_input" max_number="1" full="assert"/>
<port name="pingOut" data_type="Svc::Ping" kind="output" max_number="1"/>
<port name="timeCaller" data_type="Fw::Time" kind="output" role="TimeGet" max_number="1"/>
</ports>
<commands>
<command kind="async" opcode="0x0" mnemonic="CloseFile" full="assert">
<comment>
Forces a close of the currently opened file.
</comment>
</command>
</commands>
<port name="comIn" data_type="Fw::Com" kind="async_input" max_number="1">
</port>
<port name="timeCaller" data_type="Fw::Time" kind="output" role="TimeGet" max_number="1">
</port>
<port name="cmdRegOut" data_type="Fw::CmdReg" kind="output" role="CmdRegistration" max_number="1">
</port>
<port name="cmdIn" data_type="Fw::Cmd" kind="input" role="Cmd" max_number="1">
</port>
<port name="logOut" data_type="Fw::Log" kind="output" role="LogEvent" max_number="1">
</port>
<port name="cmdResponseOut" data_type="Fw::CmdResponse" kind="output" role="CmdResponse" max_number="1">
</port>
<port name="pingIn" data_type="Svc::Ping" kind="async_input" max_number = "1">
</port>
<port name="pingOut" data_type="Svc::Ping" kind="output" max_number = "1">
</port>
</ports>
<events>
<event id="0x0" name="FileOpenError" severity="WARNING_HI" format_string="Error %u opening file %s">
<comment>
The ComLogger encountered an error opening a file
</comment>
<args>
<arg name="errornum" type="U32">
<comment>
The error number returned from open file
</comment>
</arg>
<arg name="file" type="string" size="240">
<comment>
The file
</comment>
</arg>
</args>
</event>
<event id="0x1" name="FileWriteError" severity="WARNING_HI" format_string="Error %u while writing %u of %u bytes to %s">
<comment>
The ComLogger encountered an error writing to a file
</comment>
<args>
<arg name="errornum" type="U32">
<comment>
The error number returned from write file
</comment>
</arg>
<arg name="bytesWritten" type="U32">
<comment>
The number of bytes successfully written to file
</comment>
</arg>
<arg name="bytesToWrite" type="U32">
<comment>
The number of bytes attempted to write to file
</comment>
</arg>
<arg name="file" type="string" size="240">
<comment>
The file
</comment>
</arg>
</args>
</event>
<event id="0x2" name="FileValidationError" severity="WARNING_LO" format_string="The ComLogger failed to create a validation file %s for %s with error %u.">
<comment>
The ComLogger encountered an error writing the validation file
</comment>
<args>
<arg name="validationFile" type="string" size="240">
<comment>
The validation file
</comment>
</arg>
<arg name="file" type="string" size="240">
<comment>
The file
</comment>
</arg>
<arg name="status" type="U32">
<comment>
The Os::Validate::Status return
</comment>
</arg>
</args>
</event>
<event id="0x3" name="FileClosed" severity="DIAGNOSTIC" format_string="File %s closed successfully.">
<comment>
The ComLogger successfully closed a file on command.
</comment>
<args>
<arg name="file" type="string" size="240">
<comment>
The file
</comment>
</arg>
</args>
</event>
</events>
</component>

View File

@ -0,0 +1,3 @@
@ Forces a close of the currently opened file.
async command CloseFile \
opcode 0x00

37
Svc/ComLogger/Events.fppi Normal file
View File

@ -0,0 +1,37 @@
@ The ComLogger encountered an error opening a file
event FileOpenError(
errornum: U32 @< The error number returned from open file
file: string size 240 @< The file
) \
severity warning high \
id 0x00 \
format "Error {} opening file {}"
@ The ComLogger encountered an error writing to a file
event FileWriteError(
errornum: U32 @< The error number returned from write file
bytesWritten: U32 @< The number of bytes successfully written to file
bytesToWrite: U32 @< The number of bytes attempted to write to file
file: string size 240 @< The file
) \
severity warning high \
id 0x01 \
format "Error {} while writing {} of {} bytes to {}"
@ The ComLogger encountered an error writing the validation file
event FileValidationError(
validationFile: string size 240 @< The validation file
file: string size 240 @< The file
status: U32 @< The Os::Validate::Status return
) \
severity warning low \
id 0x02 \
format "The ComLogger failed to create a validation file {} for {} with error {}."
@ The ComLogger successfully closed a file on command.
event FileClosed(
file: string size 240 @< The file
) \
severity diagnostic \
id 0x03 \
format "File {} closed successfully."

6
Svc/ComLogger/all.do Normal file
View File

@ -0,0 +1,6 @@
#!/bin/sh -e
. ./defs.sh
redo-ifchange xml
update xml/*.xml

5
Svc/ComLogger/clean.do Normal file
View File

@ -0,0 +1,5 @@
#!/bin/sh -e
. ./defs.sh
clean_do

6
Svc/ComLogger/defs.sh Normal file
View File

@ -0,0 +1,6 @@
#!/bin/sh -e
export FPRIME_ROOT=../..
export FPP_FILES=`basename $PWD`.fpp
. $FPRIME_ROOT/defs-root.sh

5
Svc/ComLogger/depend.do Normal file
View File

@ -0,0 +1,5 @@
#!/bin/sh -e
. ./defs.sh
depend_do "$@"

View File

@ -0,0 +1,6 @@
#!/bin/sh -e
. ./defs.sh
redo-always
locate_uses_do "$@" 1>&2

5
Svc/ComLogger/xml.do Normal file
View File

@ -0,0 +1,5 @@
#!/bin/sh
. ./defs.sh
xml_do "$@"