Merge from devel

This commit is contained in:
Timothy Canham 2019-03-13 13:27:23 -07:00
commit 7c64c011d7
447 changed files with 27352 additions and 5184 deletions

4
.gitignore vendored
View File

@ -57,3 +57,7 @@ core
./Gds/docs/doxy
*Dictionary.xml
*TopologyAppID.csv
*TopologyAppAi_IDTableLog.txt
.vscode

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?eclipse-pydev version="1.0"?><pydev_project>
<pydev_property name="org.python.pydev.PYTHON_PROJECT_INTERPRETER">Default</pydev_property>
<pydev_property name="org.python.pydev.PYTHON_PROJECT_VERSION">python interpreter</pydev_property>
<pydev_property name="org.python.pydev.PYTHON_PROJECT_VERSION">python 2.7</pydev_property>
</pydev_project>

View File

@ -31,6 +31,7 @@ install:
mkdir -p $(MD_INSTALL_LOC)/plugins/gov.nasa.jpl.magicdraw.componentAutocoder
cp FpCompAuto.jar $(MD_INSTALL_LOC)/plugins/gov.nasa.jpl.magicdraw.componentAutocoder
cp plugin.xml $(MD_INSTALL_LOC)/plugins/gov.nasa.jpl.magicdraw.componentAutocoder
cp -r lib $(MD_INSTALL_LOC)/plugins/gov.nasa.jpl.magicdraw.componentAutocoder
#install: FpCompAuto.jar
# cp FpCompAuto.jar /Users/bocchino/Downloads/MagicDraw/plugins/gov.nasa.jpl.magicdraw.componentAutocoder/FpCompAuto.jar

View File

@ -1,10 +1,14 @@
This contains the MagicDraw Plugin for the Component Autocoder:
To install this plugin:
- copy the files 'FpCompAuto.jar' and 'plugin.xml' found in this directory into the MagicDraw installation plugin directory:
- copy the files 'FpCompAuto.jar' and 'plugin.xml' and directory 'lib' found in this directory into the MagicDraw installation plugin directory:
ie /Applications/MagicDraw_UML_17.2/plugins/gov.nasa.jpl.magicdraw.componentAutocoder.
- This can also be done by typing "make install MD_INSTALL_LOC=<path to MagicDraw install directory>"
```
cp -r plugin.xml FpCompAuto.jar lib /Applications/MagicDraw_UML_17.2/plugins/gov.nasa.jpl.magicdraw.componentAutocoder
```
To rebuild the plugin from the command line:
- Run 'make' in this directory. This will generate or re-generate a file 'FpCompAuto.jar' that contains the plugin.
- Copy 'FpCompAuto.jar' to 'FpCompAuto.jar' as described above.
@ -97,3 +101,7 @@ version 4.5
- Converted to Makefile based builds (Bocchino) and removed buggy sequence port autonumbering (Canham)
- Name of plug-in was changed to "FpCompAuto.jar" away from Eclipse project default name
- Added make target to install plug-in correctly
version 4.6
--------------
- Added plugin dependencies to plugin.xml for MagicDraw 18.5+

View File

@ -2,7 +2,7 @@
<plugin
id="gov.nasa.jpl.magicdraw.componentAutocoder"
name="MagicDraw Component Plugin"
version="4.5"
version="4.6"
ownClassloader="true"
provider-name="NASA Jet Propulsion Laboratory, California Institute of Technology"
class="gov.nasa.jpl.componentaction.IsfXmlAutocoderAction">
@ -10,8 +10,10 @@
<requires>
<api version="1.0"/>
</requires>
<!-- In MagicDraw 18.5+ these libraries need to be specified. -->
<runtime>
<library name="FpCompAuto.jar"/>
<library name="lib/commons-cli-1.3.1.jar"/>
<library name="lib/velocity-1.6.2-dep.jar"/>
</runtime>
</plugin>

View File

@ -340,6 +340,7 @@ def generate_topology(the_parsed_topology_xml, xml_filename, opt):
member_elem = etree.Element("member")
member_elem.attrib["name"] = member_name
member_elem.attrib["format_specifier"] = member_format_specifier
if member_comment != None:
member_elem.attrib["description"] = member_comment
if type(member_type) == type(tuple()):
enum_value = 0

View File

@ -68,9 +68,9 @@
<ref name = "data_type_and_default_define"></ref>
<!-- Elements -->
<optional>
<ref name = "comment_define"></ref>
</optional>
</element>

View File

@ -8,25 +8,25 @@ XML Source: ${source}
'''
# Import the types this way so they do not need prefixing for execution.
from models.serialize.type_exceptions import *
from models.serialize.type_base import *
from fprime.gse.models.serialize.type_exceptions import *
from fprime.gse.models.serialize.type_base import *
from models.serialize.bool_type import *
from models.serialize.enum_type import *
from models.serialize.f32_type import *
from models.serialize.f64_type import *
from fprime.gse.models.serialize.bool_type import *
from fprime.gse.models.serialize.enum_type import *
from fprime.gse.models.serialize.f32_type import *
from fprime.gse.models.serialize.f64_type import *
from models.serialize.u8_type import *
from models.serialize.u16_type import *
from models.serialize.u32_type import *
from models.serialize.u64_type import *
from fprime.gse.models.serialize.u8_type import *
from fprime.gse.models.serialize.u16_type import *
from fprime.gse.models.serialize.u32_type import *
from fprime.gse.models.serialize.u64_type import *
from models.serialize.i8_type import *
from models.serialize.i16_type import *
from models.serialize.i32_type import *
from models.serialize.i64_type import *
from fprime.gse.models.serialize.i8_type import *
from fprime.gse.models.serialize.i16_type import *
from fprime.gse.models.serialize.i32_type import *
from fprime.gse.models.serialize.i64_type import *
from models.serialize.string_type import *
from models.serialize.serializable_type import *
from fprime.gse.models.serialize.string_type import *
from fprime.gse.models.serialize.serializable_type import *
from models.common import channel_telemetry
from fprime.gse.models.common import channel_telemetry

View File

@ -8,25 +8,25 @@ XML Source: ${source}
'''
# Import the types this way so they do not need prefixing for execution.
from models.serialize.type_exceptions import *
from models.serialize.type_base import *
from fprime.gse.models.serialize.type_exceptions import *
from fprime.gse.models.serialize.type_base import *
from models.serialize.bool_type import *
from models.serialize.enum_type import *
from models.serialize.f32_type import *
from models.serialize.f64_type import *
from fprime.gse.models.serialize.bool_type import *
from fprime.gse.models.serialize.enum_type import *
from fprime.gse.models.serialize.f32_type import *
from fprime.gse.models.serialize.f64_type import *
from models.serialize.u8_type import *
from models.serialize.u16_type import *
from models.serialize.u32_type import *
from models.serialize.u64_type import *
from fprime.gse.models.serialize.u8_type import *
from fprime.gse.models.serialize.u16_type import *
from fprime.gse.models.serialize.u32_type import *
from fprime.gse.models.serialize.u64_type import *
from models.serialize.i8_type import *
from models.serialize.i16_type import *
from models.serialize.i32_type import *
from models.serialize.i64_type import *
from fprime.gse.models.serialize.i8_type import *
from fprime.gse.models.serialize.i16_type import *
from fprime.gse.models.serialize.i32_type import *
from fprime.gse.models.serialize.i64_type import *
from models.serialize.string_type import *
from models.serialize.serializable_type import *
from fprime.gse.models.serialize.string_type import *
from fprime.gse.models.serialize.serializable_type import *
from models.common import command
from fprime.gse.models.common import command

View File

@ -8,25 +8,25 @@ XML Source: ${source}
'''
# Import the types this way so they do not need prefixing for execution.
from models.serialize.type_exceptions import *
from models.serialize.type_base import *
from fprime.gse.models.serialize.type_exceptions import *
from fprime.gse.models.serialize.type_base import *
from models.serialize.bool_type import *
from models.serialize.enum_type import *
from models.serialize.f32_type import *
from models.serialize.f64_type import *
from fprime.gse.models.serialize.bool_type import *
from fprime.gse.models.serialize.enum_type import *
from fprime.gse.models.serialize.f32_type import *
from fprime.gse.models.serialize.f64_type import *
from models.serialize.u8_type import *
from models.serialize.u16_type import *
from models.serialize.u32_type import *
from models.serialize.u64_type import *
from fprime.gse.models.serialize.u8_type import *
from fprime.gse.models.serialize.u16_type import *
from fprime.gse.models.serialize.u32_type import *
from fprime.gse.models.serialize.u64_type import *
from models.serialize.i8_type import *
from models.serialize.i16_type import *
from models.serialize.i32_type import *
from models.serialize.i64_type import *
from fprime.gse.models.serialize.i8_type import *
from fprime.gse.models.serialize.i16_type import *
from fprime.gse.models.serialize.i32_type import *
from fprime.gse.models.serialize.i64_type import *
from models.serialize.string_type import *
from models.serialize.serializable_type import *
from fprime.gse.models.serialize.string_type import *
from fprime.gse.models.serialize.serializable_type import *
from models.common import event
from fprime.gse.models.common import event

View File

@ -16,5 +16,5 @@
} // end namespace $namespace
#end for
#end if
\#endif /* ${name.upper()}_HPP_ */
\#endif /* ${name_space.upper()}_${name.upper()}_PORT_HPP_ */

View File

@ -5,6 +5,6 @@
* Author: ${user}
*
*/
\#ifndef ${name.upper()}PORT_HPP_
\#define ${name.upper()}PORT_HPP_
\#ifndef ${name_space.upper()}_${name.upper()}_PORT_HPP_
\#define ${name_space.upper()}_${name.upper()}_PORT_HPP_

View File

@ -5,8 +5,10 @@ class ${name}(SerializableType):
def __init__(self):
m_list = [
#for ($membername,$type,$format_string) in $mem_list:
#for ($membername,$type,$format_string,$size) in $mem_list:
#for $i in range($size)
("$membername",$type,"$format_string"),
#end for
#end for
]

View File

@ -1,23 +1,23 @@
# Import the types this way so they do not need prefixing for execution.
from models.serialize.type_exceptions import *
from models.serialize.type_base import *
from fprime.gse.models.serialize.type_exceptions import *
from fprime.gse.models.serialize.type_base import *
from models.serialize.bool_type import *
from models.serialize.enum_type import *
from models.serialize.f32_type import *
from models.serialize.f64_type import *
from fprime.gse.models.serialize.bool_type import *
from fprime.gse.models.serialize.enum_type import *
from fprime.gse.models.serialize.f32_type import *
from fprime.gse.models.serialize.f64_type import *
from models.serialize.u8_type import *
from models.serialize.u16_type import *
from models.serialize.u32_type import *
from models.serialize.u64_type import *
from fprime.gse.models.serialize.u8_type import *
from fprime.gse.models.serialize.u16_type import *
from fprime.gse.models.serialize.u32_type import *
from fprime.gse.models.serialize.u64_type import *
from models.serialize.i8_type import *
from models.serialize.i16_type import *
from models.serialize.i32_type import *
from models.serialize.i64_type import *
from fprime.gse.models.serialize.i8_type import *
from fprime.gse.models.serialize.i16_type import *
from fprime.gse.models.serialize.i32_type import *
from fprime.gse.models.serialize.i64_type import *
from models.serialize.string_type import *
from models.serialize.serializable_type import *
from fprime.gse.models.serialize.string_type import *
from fprime.gse.models.serialize.serializable_type import *

View File

@ -147,6 +147,54 @@ $emit_port_params([ $param_portNum ] + $port_params[$instance])
#end if
#end for
#if len($serial_output_ports) > 0:
// ----------------------------------------------------------------------
// Connect serial output ports
// ----------------------------------------------------------------------
#for $instance, $sync, $priority, $max_num in $serial_output_ports:
#if $max_num == 1 or $max_num == "1":
this->component.set_${instance}_OutputPort(
0,
this->get_from_${instance}(0)
);
#else
#set LT = "<"
for (NATIVE_INT_TYPE i = 0; i $LT $max_num; ++i) {
this->component.set_${instance}_OutputPort(
i,
this->get_from_${instance}(i)
);
}
#end if
#end for
#end if
#if len($serial_input_ports) > 0:
// ----------------------------------------------------------------------
// Connect serial input ports
// ----------------------------------------------------------------------
#for $instance, $sync, $priority, $full, $max_num in $serial_input_ports:
// $instance
#if $max_num == 1 or $max_num == "1":
this->connect_to_${instance}(
0,
this->component.get_${instance}_InputPort(0)
);
#else
#set LT = "<"
for (NATIVE_INT_TYPE i = 0; i $LT $max_num; ++i) {
this->connect_to_${instance}(
i,
this->component.get_${instance}_InputPort(i)
);
}
#end if
#end for
#end if
}
void Tester ::

View File

@ -148,7 +148,7 @@ class ChannelVisitor(AbstractVisitor.AbstractVisitor):
c.ser_import = None
(c.type,c.ser_import,type_name) = DictTypeConverter.DictTypeConverter().convert(obj.get_type(),obj.get_size())
(c.type,c.ser_import,type_name,dontcare) = DictTypeConverter.DictTypeConverter().convert(obj.get_type(),obj.get_size())
# special case for enums and Gse GUI. Needs to convert %d to %s
if type_name == "enum":
c.format_string = "%s"

View File

@ -232,7 +232,7 @@ class CommandVisitor(AbstractVisitor.AbstractVisitor):
for arg_obj in obj.get_args():
# convert XML types to Python classes
(type_string,ser_import,dontcare) = DictTypeConverter.DictTypeConverter().convert(arg_obj.get_type(),arg_obj.get_size())
(type_string,ser_import,dontcare,dontcare2) = DictTypeConverter.DictTypeConverter().convert(arg_obj.get_type(),arg_obj.get_size())
if ser_import != None:
c.ser_import_list.append(ser_import)
c.arglist.append((arg_obj.get_name(),arg_obj.get_comment(),type_string))
@ -257,7 +257,7 @@ class CommandVisitor(AbstractVisitor.AbstractVisitor):
c.ser_import_list = list()
# convert XML types to Python classes
(type_string,ser_import,dontcare) = DictTypeConverter.DictTypeConverter().convert(obj.get_type(),obj.get_size())
(type_string,ser_import,dontcare,dontcare2) = DictTypeConverter.DictTypeConverter().convert(obj.get_type(),obj.get_size())
if ser_import != None:
c.ser_import_list.append(ser_import)
c.arglist.append((obj.get_name(),obj.get_comment(),type_string))

View File

@ -157,7 +157,7 @@ class EventVisitor(AbstractVisitor.AbstractVisitor):
s = arg_obj.get_size()
d = arg_obj.get_comment()
# convert XML types to Python classes
(type_string,ser_import,type_name) = DictTypeConverter.DictTypeConverter().convert(t,s)
(type_string,ser_import,type_name,dontcare) = DictTypeConverter.DictTypeConverter().convert(t,s)
if ser_import != None:
c.ser_import_list.append(ser_import)
# convert format specifier if necessary

View File

@ -169,7 +169,7 @@ class InstanceChannelVisitor(AbstractVisitor.AbstractVisitor):
c.ser_import = None
(c.type,c.ser_import,type_name) = DictTypeConverter.DictTypeConverter().convert(obj.get_type(),obj.get_size())
(c.type,c.ser_import,type_name,dontcare) = DictTypeConverter.DictTypeConverter().convert(obj.get_type(),obj.get_size())
# special case for enums and Gse GUI. Needs to convert %d to %s
if type_name == "enum":
c.format_string = "%s"

View File

@ -235,7 +235,7 @@ class InstanceCommandVisitor(AbstractVisitor.AbstractVisitor):
for arg_obj in obj.get_args():
# convert XML types to Python classes
(type_string,ser_import,dontcare) = DictTypeConverter.DictTypeConverter().convert(arg_obj.get_type(),arg_obj.get_size())
(type_string,ser_import,dontcare,dontcare2) = DictTypeConverter.DictTypeConverter().convert(arg_obj.get_type(),arg_obj.get_size())
if ser_import != None:
c.ser_import_list.append(ser_import)
c.arglist.append((arg_obj.get_name(),arg_obj.get_comment(),type_string))
@ -268,7 +268,7 @@ class InstanceCommandVisitor(AbstractVisitor.AbstractVisitor):
c.ser_import_list = list()
# convert XML types to Python classes
(type_string,ser_import,dontcare) = DictTypeConverter.DictTypeConverter().convert(obj.get_type(),obj.get_size())
(type_string,ser_import,dontcare,dontcare2) = DictTypeConverter.DictTypeConverter().convert(obj.get_type(),obj.get_size())
if ser_import != None:
c.ser_import_list.append(ser_import)
c.arglist.append((obj.get_name(),obj.get_comment(),type_string))

View File

@ -177,7 +177,7 @@ class InstanceEventVisitor(AbstractVisitor.AbstractVisitor):
s = arg_obj.get_size()
d = arg_obj.get_comment()
# convert XML types to Python classes
(type_string,ser_import,type_name) = DictTypeConverter.DictTypeConverter().convert(t,s)
(type_string,ser_import,type_name,dontcare) = DictTypeConverter.DictTypeConverter().convert(t,s)
if ser_import != None:
c.ser_import_list.append(ser_import)
# convert format specifier if necessary

View File

@ -228,7 +228,7 @@ class InstanceSerializableVisitor(AbstractVisitor.AbstractVisitor):
c.mem_list = list()
for (n,t,s,f,comment) in obj.get_members():
# convert XML types to Python classes
(type_string,dontcare,type_name) = DictTypeConverter.DictTypeConverter().convert(t,s)
(type_string,dontcare,type_name,use_size) = DictTypeConverter.DictTypeConverter().convert(t,s)
if type_name == "enum":
format_string = DictTypeConverter.DictTypeConverter().format_replace(f,0,'d','s')
# check for an error
@ -237,7 +237,7 @@ class InstanceSerializableVisitor(AbstractVisitor.AbstractVisitor):
sys.exit(-1)
else:
f = format_string
c.mem_list.append((n,type_string,f))
c.mem_list.append((n,type_string,f,int(s) if use_size else 1))
self._writeTmpl(c, "publicVisit")

View File

@ -219,6 +219,7 @@ class PortHVisitor(AbstractVisitor.AbstractVisitor):
"""
c = startPortH.startPortH()
c.name = obj.get_type
c.name_space = obj.get_namespace()
d = datetime.datetime.now()
c.date = d.strftime("%A, %d %B %Y")
c.user = os.environ['USER']
@ -370,6 +371,7 @@ class PortHVisitor(AbstractVisitor.AbstractVisitor):
else:
c.namespace_list = obj.get_namespace().split('::')
c.name = obj.get_type()
c.name_space = obj.get_namespace();
c.desc = obj.get_comment()
c.args_string = self._get_args_string(obj)
r = obj.get_return()

View File

@ -228,7 +228,7 @@ class SerializableVisitor(AbstractVisitor.AbstractVisitor):
c.mem_list = list()
for (n,t,s,f,comment) in obj.get_members():
# convert XML types to Python classes
(type_string,dontcare,type_name) = DictTypeConverter.DictTypeConverter().convert(t,s)
(type_string,dontcare,type_name,use_size) = DictTypeConverter.DictTypeConverter().convert(t,s)
if type_name == "enum":
format_string = DictTypeConverter.DictTypeConverter().format_replace(f,0,'d','s')
# check for an error
@ -237,7 +237,7 @@ class SerializableVisitor(AbstractVisitor.AbstractVisitor):
sys.exit(-1)
else:
f = format_string
c.mem_list.append((n,type_string,f))
c.mem_list.append((n,type_string,f,int(s) if use_size else 1))
self._writeTmpl(c, "publicVisit")

View File

@ -981,7 +981,7 @@ class XmlComponentParser(object):
def get_imported_dictionary_files(self):
"""
Return a list of all imported dictonary XML files.
Return a list of all imported dictionary XML files.
"""
return self.__import_dictionary_files

View File

@ -10,6 +10,7 @@ class DictTypeConverter(object):
type_string = ""
type_name = t
ser_import = None
use_size = False if size is None else True
# check for enums
if (type(t) == type(tuple())):
# extract enumeration arguments
@ -34,6 +35,7 @@ class DictTypeConverter(object):
type_name = "enum"
# otherwise, lookup type translation in table
elif t == "string":
use_size = False
type_string += "StringType(max_string_len=%s)"%size
else:
type_lookup = {
@ -56,7 +58,7 @@ class DictTypeConverter(object):
ser_type = t.split("::")
type_string += "%s.%s()" %(".".join(ser_type),ser_type[-1])
ser_import = ".".join(ser_type)
return (type_string,ser_import,type_name)
return (type_string,ser_import,type_name,use_size)
def format_replace(self, format_string, spec_num, old, new):
"""

View File

@ -74,28 +74,28 @@ namespace Cmd {
assertCmdResponse(
const char *const __callSiteFileName,
const U32 __callSiteLineNumber,
const U32 index,
const U32 __index,
const FwOpcodeType opCode,
const U32 cmdSeq,
const Fw::CommandResponse response
)
const
{
ASSERT_LT(index, this->cmdResponseHistory->size())
ASSERT_LT(__index, this->cmdResponseHistory->size())
<< "\n"
<< " File: " << __callSiteFileName << "\n"
<< " Line: " << __callSiteLineNumber << "\n"
<< " Value: Index into command response history\n"
<< " Expected: Less than size of command response history ("
<< this->cmdResponseHistory->size() << ")\n"
<< " Actual: " << index << "\n";
const CmdResponse& e = this->cmdResponseHistory->at(index);
<< " Actual: " << __index << "\n";
const CmdResponse& e = this->cmdResponseHistory->at(__index);
ASSERT_EQ(opCode, e.opCode)
<< "\n"
<< " File: " << __callSiteFileName << "\n"
<< " Line: " << __callSiteLineNumber << "\n"
<< " Value: Opcode at index "
<< index
<< __index
<< " in command response history\n"
<< " Expected: " << opCode << "\n"
<< " Actual: " << e.opCode << "\n";
@ -104,7 +104,7 @@ namespace Cmd {
<< " File: " << __callSiteFileName << "\n"
<< " Line: " << __callSiteLineNumber << "\n"
<< " Value: Command sequence number at index "
<< index
<< __index
<< " in command response history\n"
<< " Expected: " << cmdSeq << "\n"
<< " Actual: " << e.cmdSeq << "\n";
@ -113,7 +113,7 @@ namespace Cmd {
<< " File: " << __callSiteFileName << "\n"
<< " Line: " << __callSiteLineNumber << "\n"
<< " Value: Command response at index "
<< index
<< __index
<< " in command resopnse history\n"
<< " Expected: " << response << "\n"
<< " Actual: " << e.response << "\n";

View File

@ -82,7 +82,7 @@ namespace Cmd {
void assertCmdResponse(
const char *const __callSiteFileName, /*!< The name of the file containing the call site*/
const U32 __callSiteLineNumber, /*!< The line number of the call site*/
const U32 index, /*!< The index*/
const U32 __index, /*!< The index*/
const FwOpcodeType opCode, /*!< The opcode*/
const U32 cmdSeq, /*!< The command sequence number*/
const Fw::CommandResponse response /*!< The command response*/

View File

@ -74,28 +74,28 @@ namespace AcTest {
assertCmdResponse(
const char *const __callSiteFileName,
const U32 __callSiteLineNumber,
const U32 index,
const U32 __index,
const FwOpcodeType opCode,
const U32 cmdSeq,
const Fw::CommandResponse response
)
const
{
ASSERT_LT(index, this->cmdResponseHistory->size())
ASSERT_LT(__index, this->cmdResponseHistory->size())
<< "\n"
<< " File: " << __callSiteFileName << "\n"
<< " Line: " << __callSiteLineNumber << "\n"
<< " Value: Index into command response history\n"
<< " Expected: Less than size of command response history ("
<< this->cmdResponseHistory->size() << ")\n"
<< " Actual: " << index << "\n";
const CmdResponse& e = this->cmdResponseHistory->at(index);
<< " Actual: " << __index << "\n";
const CmdResponse& e = this->cmdResponseHistory->at(__index);
ASSERT_EQ(opCode, e.opCode)
<< "\n"
<< " File: " << __callSiteFileName << "\n"
<< " Line: " << __callSiteLineNumber << "\n"
<< " Value: Opcode at index "
<< index
<< __index
<< " in command response history\n"
<< " Expected: " << opCode << "\n"
<< " Actual: " << e.opCode << "\n";
@ -104,7 +104,7 @@ namespace AcTest {
<< " File: " << __callSiteFileName << "\n"
<< " Line: " << __callSiteLineNumber << "\n"
<< " Value: Command sequence number at index "
<< index
<< __index
<< " in command response history\n"
<< " Expected: " << cmdSeq << "\n"
<< " Actual: " << e.cmdSeq << "\n";
@ -113,7 +113,7 @@ namespace AcTest {
<< " File: " << __callSiteFileName << "\n"
<< " Line: " << __callSiteLineNumber << "\n"
<< " Value: Command response at index "
<< index
<< __index
<< " in command resopnse history\n"
<< " Expected: " << response << "\n"
<< " Actual: " << e.response << "\n";

View File

@ -82,7 +82,7 @@ namespace AcTest {
void assertCmdResponse(
const char *const __callSiteFileName, /*!< The name of the file containing the call site*/
const U32 __callSiteLineNumber, /*!< The line number of the call site*/
const U32 index, /*!< The index*/
const U32 __index, /*!< The index*/
const FwOpcodeType opCode, /*!< The opcode*/
const U32 cmdSeq, /*!< The command sequence number*/
const Fw::CommandResponse response /*!< The command response*/

View File

@ -74,28 +74,28 @@ namespace Cmd {
assertCmdResponse(
const char *const __callSiteFileName,
const U32 __callSiteLineNumber,
const U32 index,
const U32 __index,
const FwOpcodeType opCode,
const U32 cmdSeq,
const Fw::CommandResponse response
)
const
{
ASSERT_LT(index, this->cmdResponseHistory->size())
ASSERT_LT(__index, this->cmdResponseHistory->size())
<< "\n"
<< " File: " << __callSiteFileName << "\n"
<< " Line: " << __callSiteLineNumber << "\n"
<< " Value: Index into command response history\n"
<< " Expected: Less than size of command response history ("
<< this->cmdResponseHistory->size() << ")\n"
<< " Actual: " << index << "\n";
const CmdResponse& e = this->cmdResponseHistory->at(index);
<< " Actual: " << __index << "\n";
const CmdResponse& e = this->cmdResponseHistory->at(__index);
ASSERT_EQ(opCode, e.opCode)
<< "\n"
<< " File: " << __callSiteFileName << "\n"
<< " Line: " << __callSiteLineNumber << "\n"
<< " Value: Opcode at index "
<< index
<< __index
<< " in command response history\n"
<< " Expected: " << opCode << "\n"
<< " Actual: " << e.opCode << "\n";
@ -104,7 +104,7 @@ namespace Cmd {
<< " File: " << __callSiteFileName << "\n"
<< " Line: " << __callSiteLineNumber << "\n"
<< " Value: Command sequence number at index "
<< index
<< __index
<< " in command response history\n"
<< " Expected: " << cmdSeq << "\n"
<< " Actual: " << e.cmdSeq << "\n";
@ -113,7 +113,7 @@ namespace Cmd {
<< " File: " << __callSiteFileName << "\n"
<< " Line: " << __callSiteLineNumber << "\n"
<< " Value: Command response at index "
<< index
<< __index
<< " in command resopnse history\n"
<< " Expected: " << response << "\n"
<< " Actual: " << e.response << "\n";

View File

@ -82,7 +82,7 @@ namespace Cmd {
void assertCmdResponse(
const char *const __callSiteFileName, /*!< The name of the file containing the call site*/
const U32 __callSiteLineNumber, /*!< The line number of the call site*/
const U32 index, /*!< The index*/
const U32 __index, /*!< The index*/
const FwOpcodeType opCode, /*!< The opcode*/
const U32 cmdSeq, /*!< The command sequence number*/
const Fw::CommandResponse response /*!< The command response*/

View File

@ -74,28 +74,28 @@ namespace AcTest {
assertCmdResponse(
const char *const __callSiteFileName,
const U32 __callSiteLineNumber,
const U32 index,
const U32 __index,
const FwOpcodeType opCode,
const U32 cmdSeq,
const Fw::CommandResponse response
)
const
{
ASSERT_LT(index, this->cmdResponseHistory->size())
ASSERT_LT(__index, this->cmdResponseHistory->size())
<< "\n"
<< " File: " << __callSiteFileName << "\n"
<< " Line: " << __callSiteLineNumber << "\n"
<< " Value: Index into command response history\n"
<< " Expected: Less than size of command response history ("
<< this->cmdResponseHistory->size() << ")\n"
<< " Actual: " << index << "\n";
const CmdResponse& e = this->cmdResponseHistory->at(index);
<< " Actual: " << __index << "\n";
const CmdResponse& e = this->cmdResponseHistory->at(__index);
ASSERT_EQ(opCode, e.opCode)
<< "\n"
<< " File: " << __callSiteFileName << "\n"
<< " Line: " << __callSiteLineNumber << "\n"
<< " Value: Opcode at index "
<< index
<< __index
<< " in command response history\n"
<< " Expected: " << opCode << "\n"
<< " Actual: " << e.opCode << "\n";
@ -104,7 +104,7 @@ namespace AcTest {
<< " File: " << __callSiteFileName << "\n"
<< " Line: " << __callSiteLineNumber << "\n"
<< " Value: Command sequence number at index "
<< index
<< __index
<< " in command response history\n"
<< " Expected: " << cmdSeq << "\n"
<< " Actual: " << e.cmdSeq << "\n";
@ -113,7 +113,7 @@ namespace AcTest {
<< " File: " << __callSiteFileName << "\n"
<< " Line: " << __callSiteLineNumber << "\n"
<< " Value: Command response at index "
<< index
<< __index
<< " in command resopnse history\n"
<< " Expected: " << response << "\n"
<< " Actual: " << e.response << "\n";

View File

@ -82,7 +82,7 @@ namespace AcTest {
void assertCmdResponse(
const char *const __callSiteFileName, /*!< The name of the file containing the call site*/
const U32 __callSiteLineNumber, /*!< The line number of the call site*/
const U32 index, /*!< The index*/
const U32 __index, /*!< The index*/
const FwOpcodeType opCode, /*!< The opcode*/
const U32 cmdSeq, /*!< The command sequence number*/
const Fw::CommandResponse response /*!< The command response*/

View File

@ -75,28 +75,28 @@ namespace Components {
assertCmdResponse(
const char *const __callSiteFileName,
const U32 __callSiteLineNumber,
const U32 index,
const U32 __index,
const FwOpcodeType opCode,
const U32 cmdSeq,
const Fw::CommandResponse response
)
const
{
ASSERT_LT(index, this->cmdResponseHistory->size())
ASSERT_LT(__index, this->cmdResponseHistory->size())
<< "\n"
<< " File: " << __callSiteFileName << "\n"
<< " Line: " << __callSiteLineNumber << "\n"
<< " Value: Index into command response history\n"
<< " Expected: Less than size of command response history ("
<< this->cmdResponseHistory->size() << ")\n"
<< " Actual: " << index << "\n";
const CmdResponse& e = this->cmdResponseHistory->at(index);
<< " Actual: " << __index << "\n";
const CmdResponse& e = this->cmdResponseHistory->at(__index);
ASSERT_EQ(opCode, e.opCode)
<< "\n"
<< " File: " << __callSiteFileName << "\n"
<< " Line: " << __callSiteLineNumber << "\n"
<< " Value: Opcode at index "
<< index
<< __index
<< " in command response history\n"
<< " Expected: " << opCode << "\n"
<< " Actual: " << e.opCode << "\n";
@ -105,7 +105,7 @@ namespace Components {
<< " File: " << __callSiteFileName << "\n"
<< " Line: " << __callSiteLineNumber << "\n"
<< " Value: Command sequence number at index "
<< index
<< __index
<< " in command response history\n"
<< " Expected: " << cmdSeq << "\n"
<< " Actual: " << e.cmdSeq << "\n";
@ -114,7 +114,7 @@ namespace Components {
<< " File: " << __callSiteFileName << "\n"
<< " Line: " << __callSiteLineNumber << "\n"
<< " Value: Command response at index "
<< index
<< __index
<< " in command resopnse history\n"
<< " Expected: " << response << "\n"
<< " Actual: " << e.response << "\n";
@ -164,27 +164,27 @@ namespace Components {
assertTlm_somechan(
const char *const __callSiteFileName,
const U32 __callSiteLineNumber,
const U32 index,
const U32 __index,
const Ref::Gnc::Quaternion& val
)
const
{
ASSERT_LT(index, this->tlmHistory_somechan->size())
ASSERT_LT(__index, this->tlmHistory_somechan->size())
<< "\n"
<< " File: " << __callSiteFileName << "\n"
<< " Line: " << __callSiteLineNumber << "\n"
<< " Value: Index into history of telemetry channel somechan\n"
<< " Expected: Less than size of history ("
<< this->tlmHistory_somechan->size() << ")\n"
<< " Actual: " << index << "\n";
<< " Actual: " << __index << "\n";
const TlmEntry_somechan& e =
this->tlmHistory_somechan->at(index);
this->tlmHistory_somechan->at(__index);
ASSERT_EQ(val, e.arg)
<< "\n"
<< " File: " << __callSiteFileName << "\n"
<< " Line: " << __callSiteLineNumber << "\n"
<< " Value: Value at index "
<< index
<< __index
<< " on telmetry channel somechan\n"
<< " Expected: " << val << "\n"
<< " Actual: " << e.arg << "\n";
@ -234,28 +234,28 @@ namespace Components {
assertEvents_SomeEvent(
const char *const __callSiteFileName,
const U32 __callSiteLineNumber,
const U32 index,
const U32 __index,
const Ref::Gnc::Quaternion arg1,
const F32 arg2,
const U8 arg3
) const
{
ASSERT_GT(this->eventHistory_SomeEvent->size(), index)
ASSERT_GT(this->eventHistory_SomeEvent->size(), __index)
<< "\n"
<< " File: " << __callSiteFileName << "\n"
<< " Line: " << __callSiteLineNumber << "\n"
<< " Value: Index into history of event SomeEvent\n"
<< " Expected: Less than size of history ("
<< this->eventHistory_SomeEvent->size() << ")\n"
<< " Actual: " << index << "\n";
<< " Actual: " << __index << "\n";
const EventEntry_SomeEvent& e =
this->eventHistory_SomeEvent->at(index);
this->eventHistory_SomeEvent->at(__index);
ASSERT_EQ(arg1, e.arg1)
<< "\n"
<< " File: " << __callSiteFileName << "\n"
<< " Line: " << __callSiteLineNumber << "\n"
<< " Value: Value of argument arg1 at index "
<< index
<< __index
<< " in history of event SomeEvent\n"
<< " Expected: " << arg1 << "\n"
<< " Actual: " << e.arg1 << "\n";
@ -264,7 +264,7 @@ namespace Components {
<< " File: " << __callSiteFileName << "\n"
<< " Line: " << __callSiteLineNumber << "\n"
<< " Value: Value of argument arg2 at index "
<< index
<< __index
<< " in history of event SomeEvent\n"
<< " Expected: " << arg2 << "\n"
<< " Actual: " << e.arg2 << "\n";
@ -273,7 +273,7 @@ namespace Components {
<< " File: " << __callSiteFileName << "\n"
<< " Line: " << __callSiteLineNumber << "\n"
<< " Value: Value of argument arg3 at index "
<< index
<< __index
<< " in history of event SomeEvent\n"
<< " Expected: " << arg3 << "\n"
<< " Actual: " << e.arg3 << "\n";

View File

@ -110,7 +110,7 @@ namespace Components {
void assertCmdResponse(
const char *const __callSiteFileName, /*!< The name of the file containing the call site*/
const U32 __callSiteLineNumber, /*!< The line number of the call site*/
const U32 index, /*!< The index*/
const U32 __index, /*!< The index*/
const FwOpcodeType opCode, /*!< The opcode*/
const U32 cmdSeq, /*!< The command sequence number*/
const Fw::CommandResponse response /*!< The command response*/
@ -147,7 +147,7 @@ namespace Components {
void assertTlm_somechan(
const char *const __callSiteFileName, /*!< The name of the file containing the call site*/
const U32 __callSiteLineNumber, /*!< The line number of the call site*/
const U32 index, /*!< The index*/
const U32 __index, /*!< The index*/
const Ref::Gnc::Quaternion& val /*!< The channel value*/
) const;
@ -178,7 +178,7 @@ namespace Components {
void assertEvents_SomeEvent(
const char *const __callSiteFileName, /*!< The name of the file containing the call site*/
const U32 __callSiteLineNumber, /*!< The line number of the call site*/
const U32 index, /*!< The index*/
const U32 __index, /*!< The index*/
const Ref::Gnc::Quaternion arg1, /*!< The quaternion command argument*/
const F32 arg2, /*!< The F32 command argument*/
const U8 arg3 /*!< The U8 command argument*/

View File

@ -94,28 +94,28 @@ namespace Somewhere {
assertEvents_SomeEvent(
const char *const __callSiteFileName,
const U32 __callSiteLineNumber,
const U32 index,
const U32 __index,
const I32 arg1,
const F32 arg2,
const U8 arg3
) const
{
ASSERT_GT(this->eventHistory_SomeEvent->size(), index)
ASSERT_GT(this->eventHistory_SomeEvent->size(), __index)
<< "\n"
<< " File: " << __callSiteFileName << "\n"
<< " Line: " << __callSiteLineNumber << "\n"
<< " Value: Index into history of event SomeEvent\n"
<< " Expected: Less than size of history ("
<< this->eventHistory_SomeEvent->size() << ")\n"
<< " Actual: " << index << "\n";
<< " Actual: " << __index << "\n";
const EventEntry_SomeEvent& e =
this->eventHistory_SomeEvent->at(index);
this->eventHistory_SomeEvent->at(__index);
ASSERT_EQ(arg1, e.arg1)
<< "\n"
<< " File: " << __callSiteFileName << "\n"
<< " Line: " << __callSiteLineNumber << "\n"
<< " Value: Value of argument arg1 at index "
<< index
<< __index
<< " in history of event SomeEvent\n"
<< " Expected: " << arg1 << "\n"
<< " Actual: " << e.arg1 << "\n";
@ -124,7 +124,7 @@ namespace Somewhere {
<< " File: " << __callSiteFileName << "\n"
<< " Line: " << __callSiteLineNumber << "\n"
<< " Value: Value of argument arg2 at index "
<< index
<< __index
<< " in history of event SomeEvent\n"
<< " Expected: " << arg2 << "\n"
<< " Actual: " << e.arg2 << "\n";
@ -133,7 +133,7 @@ namespace Somewhere {
<< " File: " << __callSiteFileName << "\n"
<< " Line: " << __callSiteLineNumber << "\n"
<< " Value: Value of argument arg3 at index "
<< index
<< __index
<< " in history of event SomeEvent\n"
<< " Expected: " << arg3 << "\n"
<< " Actual: " << e.arg3 << "\n";

View File

@ -93,7 +93,7 @@ namespace Somewhere {
void assertEvents_SomeEvent(
const char *const __callSiteFileName, /*!< The name of the file containing the call site*/
const U32 __callSiteLineNumber, /*!< The line number of the call site*/
const U32 index, /*!< The index*/
const U32 __index, /*!< The index*/
const I32 arg1, /*!< The I32 command argument*/
const F32 arg2, /*!< The F32 command argument*/
const U8 arg3 /*!< The U8 command argument*/

View File

@ -94,28 +94,28 @@ namespace Cmd {
assertEvents_SomeEvent(
const char *const __callSiteFileName,
const U32 __callSiteLineNumber,
const U32 index,
const U32 __index,
const I32 arg1,
const F32 arg2,
const Ref::Gnc::Quaternion arg3
) const
{
ASSERT_GT(this->eventHistory_SomeEvent->size(), index)
ASSERT_GT(this->eventHistory_SomeEvent->size(), __index)
<< "\n"
<< " File: " << __callSiteFileName << "\n"
<< " Line: " << __callSiteLineNumber << "\n"
<< " Value: Index into history of event SomeEvent\n"
<< " Expected: Less than size of history ("
<< this->eventHistory_SomeEvent->size() << ")\n"
<< " Actual: " << index << "\n";
<< " Actual: " << __index << "\n";
const EventEntry_SomeEvent& e =
this->eventHistory_SomeEvent->at(index);
this->eventHistory_SomeEvent->at(__index);
ASSERT_EQ(arg1, e.arg1)
<< "\n"
<< " File: " << __callSiteFileName << "\n"
<< " Line: " << __callSiteLineNumber << "\n"
<< " Value: Value of argument arg1 at index "
<< index
<< __index
<< " in history of event SomeEvent\n"
<< " Expected: " << arg1 << "\n"
<< " Actual: " << e.arg1 << "\n";
@ -124,7 +124,7 @@ namespace Cmd {
<< " File: " << __callSiteFileName << "\n"
<< " Line: " << __callSiteLineNumber << "\n"
<< " Value: Value of argument arg2 at index "
<< index
<< __index
<< " in history of event SomeEvent\n"
<< " Expected: " << arg2 << "\n"
<< " Actual: " << e.arg2 << "\n";
@ -133,7 +133,7 @@ namespace Cmd {
<< " File: " << __callSiteFileName << "\n"
<< " Line: " << __callSiteLineNumber << "\n"
<< " Value: Value of argument arg3 at index "
<< index
<< __index
<< " in history of event SomeEvent\n"
<< " Expected: " << arg3 << "\n"
<< " Actual: " << e.arg3 << "\n";

View File

@ -93,7 +93,7 @@ namespace Cmd {
void assertEvents_SomeEvent(
const char *const __callSiteFileName, /*!< The name of the file containing the call site*/
const U32 __callSiteLineNumber, /*!< The line number of the call site*/
const U32 index, /*!< The index*/
const U32 __index, /*!< The index*/
const I32 arg1, /*!< The I32 command argument*/
const F32 arg2, /*!< The F32 command argument*/
const Ref::Gnc::Quaternion arg3 /*!< The U8 command argument*/

View File

@ -94,28 +94,28 @@ namespace Somewhere {
assertEvents_SomeEvent(
const char *const __callSiteFileName,
const U32 __callSiteLineNumber,
const U32 index,
const U32 __index,
const I32 arg1,
TestLogComponentBase::SomeEnum arg2,
const U8 arg3
) const
{
ASSERT_GT(this->eventHistory_SomeEvent->size(), index)
ASSERT_GT(this->eventHistory_SomeEvent->size(), __index)
<< "\n"
<< " File: " << __callSiteFileName << "\n"
<< " Line: " << __callSiteLineNumber << "\n"
<< " Value: Index into history of event SomeEvent\n"
<< " Expected: Less than size of history ("
<< this->eventHistory_SomeEvent->size() << ")\n"
<< " Actual: " << index << "\n";
<< " Actual: " << __index << "\n";
const EventEntry_SomeEvent& e =
this->eventHistory_SomeEvent->at(index);
this->eventHistory_SomeEvent->at(__index);
ASSERT_EQ(arg1, e.arg1)
<< "\n"
<< " File: " << __callSiteFileName << "\n"
<< " Line: " << __callSiteLineNumber << "\n"
<< " Value: Value of argument arg1 at index "
<< index
<< __index
<< " in history of event SomeEvent\n"
<< " Expected: " << arg1 << "\n"
<< " Actual: " << e.arg1 << "\n";
@ -124,7 +124,7 @@ namespace Somewhere {
<< " File: " << __callSiteFileName << "\n"
<< " Line: " << __callSiteLineNumber << "\n"
<< " Value: Value of argument arg2 at index "
<< index
<< __index
<< " in history of event SomeEvent\n"
<< " Expected: " << arg2 << "\n"
<< " Actual: " << e.arg2 << "\n";
@ -133,7 +133,7 @@ namespace Somewhere {
<< " File: " << __callSiteFileName << "\n"
<< " Line: " << __callSiteLineNumber << "\n"
<< " Value: Value of argument arg3 at index "
<< index
<< __index
<< " in history of event SomeEvent\n"
<< " Expected: " << arg3 << "\n"
<< " Actual: " << e.arg3 << "\n";

View File

@ -93,7 +93,7 @@ namespace Somewhere {
void assertEvents_SomeEvent(
const char *const __callSiteFileName, /*!< The name of the file containing the call site*/
const U32 __callSiteLineNumber, /*!< The line number of the call site*/
const U32 index, /*!< The index*/
const U32 __index, /*!< The index*/
const I32 arg1, /*!< The I32 command argument*/
TestLogComponentBase::SomeEnum arg2, /*!< The enum command argument*/
const U8 arg3 /*!< The U8 command argument*/

View File

@ -94,28 +94,28 @@ namespace Somewhere {
assertEvents_SomeEvent(
const char *const __callSiteFileName,
const U32 __callSiteLineNumber,
const U32 index,
const U32 __index,
const I32 arg1,
const char *const arg2,
const U8 arg3
) const
{
ASSERT_GT(this->eventHistory_SomeEvent->size(), index)
ASSERT_GT(this->eventHistory_SomeEvent->size(), __index)
<< "\n"
<< " File: " << __callSiteFileName << "\n"
<< " Line: " << __callSiteLineNumber << "\n"
<< " Value: Index into history of event SomeEvent\n"
<< " Expected: Less than size of history ("
<< this->eventHistory_SomeEvent->size() << ")\n"
<< " Actual: " << index << "\n";
<< " Actual: " << __index << "\n";
const EventEntry_SomeEvent& e =
this->eventHistory_SomeEvent->at(index);
this->eventHistory_SomeEvent->at(__index);
ASSERT_EQ(arg1, e.arg1)
<< "\n"
<< " File: " << __callSiteFileName << "\n"
<< " Line: " << __callSiteLineNumber << "\n"
<< " Value: Value of argument arg1 at index "
<< index
<< __index
<< " in history of event SomeEvent\n"
<< " Expected: " << arg1 << "\n"
<< " Actual: " << e.arg1 << "\n";
@ -124,7 +124,7 @@ namespace Somewhere {
<< " File: " << __callSiteFileName << "\n"
<< " Line: " << __callSiteLineNumber << "\n"
<< " Value: Value of argument arg2 at index "
<< index
<< __index
<< " in history of event SomeEvent\n"
<< " Expected: " << arg2 << "\n"
<< " Actual: " << e.arg2.toChar() << "\n";
@ -133,7 +133,7 @@ namespace Somewhere {
<< " File: " << __callSiteFileName << "\n"
<< " Line: " << __callSiteLineNumber << "\n"
<< " Value: Value of argument arg3 at index "
<< index
<< __index
<< " in history of event SomeEvent\n"
<< " Expected: " << arg3 << "\n"
<< " Actual: " << e.arg3 << "\n";

View File

@ -93,7 +93,7 @@ namespace Somewhere {
void assertEvents_SomeEvent(
const char *const __callSiteFileName, /*!< The name of the file containing the call site*/
const U32 __callSiteLineNumber, /*!< The line number of the call site*/
const U32 index, /*!< The index*/
const U32 __index, /*!< The index*/
const I32 arg1, /*!< The I32 command argument*/
const char *const arg2, /*!< The F32 command argument*/
const U8 arg3 /*!< The U8 command argument*/

View File

@ -94,28 +94,28 @@ namespace Somewhere {
assertEvents_SomeEvent(
const char *const __callSiteFileName,
const U32 __callSiteLineNumber,
const U32 index,
const U32 __index,
const I32 arg1,
const F32 arg2,
const U8 arg3
) const
{
ASSERT_GT(this->eventHistory_SomeEvent->size(), index)
ASSERT_GT(this->eventHistory_SomeEvent->size(), __index)
<< "\n"
<< " File: " << __callSiteFileName << "\n"
<< " Line: " << __callSiteLineNumber << "\n"
<< " Value: Index into history of event SomeEvent\n"
<< " Expected: Less than size of history ("
<< this->eventHistory_SomeEvent->size() << ")\n"
<< " Actual: " << index << "\n";
<< " Actual: " << __index << "\n";
const EventEntry_SomeEvent& e =
this->eventHistory_SomeEvent->at(index);
this->eventHistory_SomeEvent->at(__index);
ASSERT_EQ(arg1, e.arg1)
<< "\n"
<< " File: " << __callSiteFileName << "\n"
<< " Line: " << __callSiteLineNumber << "\n"
<< " Value: Value of argument arg1 at index "
<< index
<< __index
<< " in history of event SomeEvent\n"
<< " Expected: " << arg1 << "\n"
<< " Actual: " << e.arg1 << "\n";
@ -124,7 +124,7 @@ namespace Somewhere {
<< " File: " << __callSiteFileName << "\n"
<< " Line: " << __callSiteLineNumber << "\n"
<< " Value: Value of argument arg2 at index "
<< index
<< __index
<< " in history of event SomeEvent\n"
<< " Expected: " << arg2 << "\n"
<< " Actual: " << e.arg2 << "\n";
@ -133,7 +133,7 @@ namespace Somewhere {
<< " File: " << __callSiteFileName << "\n"
<< " Line: " << __callSiteLineNumber << "\n"
<< " Value: Value of argument arg3 at index "
<< index
<< __index
<< " in history of event SomeEvent\n"
<< " Expected: " << arg3 << "\n"
<< " Actual: " << e.arg3 << "\n";
@ -163,28 +163,28 @@ namespace Somewhere {
assertEvents_SomeOtherEvent(
const char *const __callSiteFileName,
const U32 __callSiteLineNumber,
const U32 index,
const U32 __index,
const I32 arg1,
const F32 arg2,
const U8 arg3
) const
{
ASSERT_GT(this->eventHistory_SomeOtherEvent->size(), index)
ASSERT_GT(this->eventHistory_SomeOtherEvent->size(), __index)
<< "\n"
<< " File: " << __callSiteFileName << "\n"
<< " Line: " << __callSiteLineNumber << "\n"
<< " Value: Index into history of event SomeOtherEvent\n"
<< " Expected: Less than size of history ("
<< this->eventHistory_SomeOtherEvent->size() << ")\n"
<< " Actual: " << index << "\n";
<< " Actual: " << __index << "\n";
const EventEntry_SomeOtherEvent& e =
this->eventHistory_SomeOtherEvent->at(index);
this->eventHistory_SomeOtherEvent->at(__index);
ASSERT_EQ(arg1, e.arg1)
<< "\n"
<< " File: " << __callSiteFileName << "\n"
<< " Line: " << __callSiteLineNumber << "\n"
<< " Value: Value of argument arg1 at index "
<< index
<< __index
<< " in history of event SomeOtherEvent\n"
<< " Expected: " << arg1 << "\n"
<< " Actual: " << e.arg1 << "\n";
@ -193,7 +193,7 @@ namespace Somewhere {
<< " File: " << __callSiteFileName << "\n"
<< " Line: " << __callSiteLineNumber << "\n"
<< " Value: Value of argument arg2 at index "
<< index
<< __index
<< " in history of event SomeOtherEvent\n"
<< " Expected: " << arg2 << "\n"
<< " Actual: " << e.arg2 << "\n";
@ -202,7 +202,7 @@ namespace Somewhere {
<< " File: " << __callSiteFileName << "\n"
<< " Line: " << __callSiteLineNumber << "\n"
<< " Value: Value of argument arg3 at index "
<< index
<< __index
<< " in history of event SomeOtherEvent\n"
<< " Expected: " << arg3 << "\n"
<< " Actual: " << e.arg3 << "\n";

View File

@ -99,7 +99,7 @@ namespace Somewhere {
void assertEvents_SomeEvent(
const char *const __callSiteFileName, /*!< The name of the file containing the call site*/
const U32 __callSiteLineNumber, /*!< The line number of the call site*/
const U32 index, /*!< The index*/
const U32 __index, /*!< The index*/
const I32 arg1, /*!< The I32 command argument*/
const F32 arg2, /*!< The F32 command argument*/
const U8 arg3 /*!< The U8 command argument*/
@ -120,7 +120,7 @@ namespace Somewhere {
void assertEvents_SomeOtherEvent(
const char *const __callSiteFileName, /*!< The name of the file containing the call site*/
const U32 __callSiteLineNumber, /*!< The line number of the call site*/
const U32 index, /*!< The index*/
const U32 __index, /*!< The index*/
const I32 arg1, /*!< The I32 command argument*/
const F32 arg2, /*!< The F32 command argument*/
const U8 arg3 /*!< The U8 command argument*/

View File

@ -94,27 +94,27 @@ namespace Tlm {
assertTlm_somechan(
const char *const __callSiteFileName,
const U32 __callSiteLineNumber,
const U32 index,
const U32 __index,
const U32& val
)
const
{
ASSERT_LT(index, this->tlmHistory_somechan->size())
ASSERT_LT(__index, this->tlmHistory_somechan->size())
<< "\n"
<< " File: " << __callSiteFileName << "\n"
<< " Line: " << __callSiteLineNumber << "\n"
<< " Value: Index into history of telemetry channel somechan\n"
<< " Expected: Less than size of history ("
<< this->tlmHistory_somechan->size() << ")\n"
<< " Actual: " << index << "\n";
<< " Actual: " << __index << "\n";
const TlmEntry_somechan& e =
this->tlmHistory_somechan->at(index);
this->tlmHistory_somechan->at(__index);
ASSERT_EQ(val, e.arg)
<< "\n"
<< " File: " << __callSiteFileName << "\n"
<< " Line: " << __callSiteLineNumber << "\n"
<< " Value: Value at index "
<< index
<< __index
<< " on telmetry channel somechan\n"
<< " Expected: " << val << "\n"
<< " Actual: " << e.arg << "\n";

View File

@ -97,7 +97,7 @@ namespace Tlm {
void assertTlm_somechan(
const char *const __callSiteFileName, /*!< The name of the file containing the call site*/
const U32 __callSiteLineNumber, /*!< The line number of the call site*/
const U32 index, /*!< The index*/
const U32 __index, /*!< The index*/
const U32& val /*!< The channel value*/
) const;

View File

@ -94,27 +94,27 @@ namespace Tlm {
assertTlm_AQuat(
const char *const __callSiteFileName,
const U32 __callSiteLineNumber,
const U32 index,
const U32 __index,
const Ref::Gnc::Quaternion& val
)
const
{
ASSERT_LT(index, this->tlmHistory_AQuat->size())
ASSERT_LT(__index, this->tlmHistory_AQuat->size())
<< "\n"
<< " File: " << __callSiteFileName << "\n"
<< " Line: " << __callSiteLineNumber << "\n"
<< " Value: Index into history of telemetry channel AQuat\n"
<< " Expected: Less than size of history ("
<< this->tlmHistory_AQuat->size() << ")\n"
<< " Actual: " << index << "\n";
<< " Actual: " << __index << "\n";
const TlmEntry_AQuat& e =
this->tlmHistory_AQuat->at(index);
this->tlmHistory_AQuat->at(__index);
ASSERT_EQ(val, e.arg)
<< "\n"
<< " File: " << __callSiteFileName << "\n"
<< " Line: " << __callSiteLineNumber << "\n"
<< " Value: Value at index "
<< index
<< __index
<< " on telmetry channel AQuat\n"
<< " Expected: " << val << "\n"
<< " Actual: " << e.arg << "\n";

View File

@ -97,7 +97,7 @@ namespace Tlm {
void assertTlm_AQuat(
const char *const __callSiteFileName, /*!< The name of the file containing the call site*/
const U32 __callSiteLineNumber, /*!< The line number of the call site*/
const U32 index, /*!< The index*/
const U32 __index, /*!< The index*/
const Ref::Gnc::Quaternion& val /*!< The channel value*/
) const;

View File

@ -11,6 +11,7 @@
<import_port_type>Svc/Cycle/CyclePortAi.xml</import_port_type>
<import_port_type>Drv/DataTypes/DataBufferPortAi.xml</import_port_type>
<import_port_type>Svc/Ping/PingPortAi.xml</import_port_type>
<import_dictionary>Drv/BlockDriver/Tlm.xml</import_dictionary>
<comment>An example block driver component with data buffers and interrupts</comment>
<ports>
@ -54,13 +55,6 @@
</port>
</ports>
<telemetry>
<channel id="0" name="BD_Cycles" data_type="U32" abbrev="T002-1234">
<comment>
Driver cycle count
</comment>
</channel>
</telemetry>
<internal_interfaces>
<internal_interface name="InterruptReport" priority="1">
<comment>

View File

@ -1,6 +1,6 @@
<events>
<!-- Open error -->
<event id="0" name="GP_OpenError" severity="WARNING_HI" format_string = "Error opening GPIO device %d: %d" >
<event id="0" name="GP_OpenError" severity="WARNING_HI" format_string = "Error opening GPIO device %d: %d (%s)" >
<comment>
Open error
</comment>
@ -11,6 +11,9 @@
<arg name="error" type="I32">
<comment>The error code</comment>
</arg>
<arg name="msg" type="string" size="40">
<comment>The error string</comment>
</arg>
</args>
</event>
<!-- Open error -->

View File

@ -181,7 +181,7 @@ namespace Drv {
* gpio_set_edge
****************************************************************/
int gpio_set_edge(unsigned int gpio, char *edge)
int gpio_set_edge(unsigned int gpio, const char *edge)
{
int fd, len;
char buf[MAX_BUF];
@ -288,11 +288,15 @@ namespace Drv {
// Configure:
stat = gpio_export(gpio);
if (-1 == stat) {
this->log_WARNING_HI_GP_OpenError(gpio,this->m_fd);
Fw::LogStringArg arg = strerror(errno);
this->log_WARNING_HI_GP_OpenError(gpio,stat,arg);
return false;
}
stat = gpio_set_dir(gpio, direction == GPIO_OUT ? 1 : 0);
if (-1 == stat) {
this->log_WARNING_HI_GP_OpenError(gpio,this->m_fd);
Fw::LogStringArg arg = strerror(errno);
this->log_WARNING_HI_GP_OpenError(gpio,stat,arg);
return false;
}
// If needed, set edge to rising in intTaskEntry()
@ -300,7 +304,8 @@ namespace Drv {
// Open:
this->m_fd = gpio_fd_open(gpio);
if (-1 == this->m_fd) {
this->log_WARNING_HI_GP_OpenError(gpio,this->m_fd);
Fw::LogStringArg arg = strerror(errno);
this->log_WARNING_HI_GP_OpenError(gpio,errno,arg);
} else {
this->m_gpio = gpio;
}

View File

@ -10,6 +10,7 @@
|GP_OpenError|0 (0x0)|Open error| | | | |
| | | |gpio|I32||The device|
| | | |error|I32||The error code|
| | | |msg|Fw::LogStringArg&|40|The error string|
|GP_ConfigError|1 (0x1)|GPIO configure error| | | | |
| | | |gpio|I32||The device|
| | | |error|I32||The error code|

View File

@ -21,9 +21,11 @@ SRC_CYGWIN = LinuxGpioDriverComponentImpl.cpp
SRC_DARWIN = LinuxGpioDriverComponentImplStub.cpp
SRC_RASPIAN = LinuxGpioDriverComponentImpl.cpp
SRC_LINUXRT = LinuxGpioDriverComponentImpl.cpp
HDR = LinuxGpioDriverComponentImpl.hpp
SUBDIRS = test
SRC_LINUXRT = LinuxGpioDriverComponentImpl.cpp

View File

@ -1,6 +1,6 @@
<events>
<!-- Open error -->
<event id="0" name="DR_OpenError" severity="WARNING_HI" format_string = "Error opening UART device %s: %d" >
<event id="0" name="DR_OpenError" severity="WARNING_HI" format_string = "Error opening UART device %s: %d %s" >
<comment>
UART open error
</comment>
@ -11,6 +11,9 @@
<arg name="error" type="I32">
<comment>The error code</comment>
</arg>
<arg name="name" type="string" size="40">
<comment>error string</comment>
</arg>
</args>
</event>
<!-- Config error -->

View File

@ -41,7 +41,7 @@ namespace Drv {
// Construction, initialization, and destruction
// ----------------------------------------------------------------------
void LinuxSerialDriverComponentImpl::open(const char* const device, UartBaudRate baud, UartFlowControl fc, UartParity parity, bool block) {
bool LinuxSerialDriverComponentImpl::open(const char* const device, UartBaudRate baud, UartFlowControl fc, UartParity parity, bool block) {
/*
Their config:
@ -78,8 +78,9 @@ namespace Drv {
if (fd == -1) {
DEBUG_PRINT("open UART device %s failed.\n", device);
Fw::LogStringArg _arg = device;
this->log_WARNING_HI_DR_OpenError(_arg,this->m_fd);
return;
Fw::LogStringArg _err = strerror(errno);
this->log_WARNING_HI_DR_OpenError(_arg,this->m_fd,_err);
return false;
} else {
DEBUG_PRINT("Successfully opened UART device %s fd %d\n", device, fd);
}
@ -94,8 +95,9 @@ namespace Drv {
DEBUG_PRINT("tcgetattr failed: (%d): %s\n",stat,strerror(errno));
close(fd);
Fw::LogStringArg _arg = device;
this->log_WARNING_HI_DR_OpenError(_arg,fd);
return;
Fw::LogStringArg _err = strerror(errno);
this->log_WARNING_HI_DR_OpenError(_arg,fd,_err);
return false;
} else {
DEBUG_PRINT("tcgetattr passed.\n");
}
@ -119,8 +121,9 @@ namespace Drv {
DEBUG_PRINT("tcsetattr failed: (%d): %s\n",stat,strerror(errno));
close(fd);
Fw::LogStringArg _arg = device;
this->log_WARNING_HI_DR_OpenError(_arg,fd);
return;
Fw::LogStringArg _err = strerror(errno);
this->log_WARNING_HI_DR_OpenError(_arg,fd,_err);
return false;
} else {
DEBUG_PRINT("tcsetattr passed.\n");
}
@ -135,8 +138,9 @@ namespace Drv {
DEBUG_PRINT("tcgetattr UART fd %d failed\n", fd);
close(fd);
Fw::LogStringArg _arg = device;
this->log_WARNING_HI_DR_OpenError(_arg,fd);
return;
Fw::LogStringArg _err = strerror(errno);
this->log_WARNING_HI_DR_OpenError(_arg,fd,_err);
return false;
}
// modify flow control flags
@ -147,8 +151,9 @@ namespace Drv {
DEBUG_PRINT("tcsetattr UART fd %d failed\n", fd);
close(fd);
Fw::LogStringArg _arg = device;
this->log_WARNING_HI_DR_OpenError(_arg,fd);
return;
Fw::LogStringArg _err = strerror(errno);
this->log_WARNING_HI_DR_OpenError(_arg,fd,_err);
return false;
}
}
@ -191,8 +196,9 @@ namespace Drv {
DEBUG_PRINT("tcgetattr UART fd %d failed\n", fd);
close(fd);
Fw::LogStringArg _arg = device;
this->log_WARNING_HI_DR_OpenError(_arg,fd);
return;
Fw::LogStringArg _err = strerror(errno);
this->log_WARNING_HI_DR_OpenError(_arg,fd,_err);
return false;
}
// CS8 = 8 data bits, CLOCAL = Local line, CREAD = Enable Reciever
@ -251,14 +257,15 @@ namespace Drv {
DEBUG_PRINT("tcsetattr UART fd %d failed\n", fd);
close(fd);
Fw::LogStringArg _arg = device;
this->log_WARNING_HI_DR_OpenError(_arg,fd);
return;
Fw::LogStringArg _err = strerror(errno);
this->log_WARNING_HI_DR_OpenError(_arg,fd,_err);
return false;
}
// All done!
Fw::LogStringArg _arg = device;
this->log_ACTIVITY_HI_DR_PortOpened(_arg);
return true;
}
LinuxSerialDriverComponentImpl ::

View File

@ -76,7 +76,7 @@ namespace Drv {
} UartParity;
// Open device with specified baud and flow control.
void open(const char* const device, UartBaudRate baud, UartFlowControl fc, UartParity parity, bool block);
bool open(const char* const device, UartBaudRate baud, UartFlowControl fc, UartParity parity, bool block);
//! start the serial poll thread.
//! buffSize is the max receive buffer size
@ -107,7 +107,7 @@ namespace Drv {
//!
void readBufferSend_handler(
const NATIVE_INT_TYPE portNum, /*!< The port number*/
Fw::Buffer fwBuffer
Fw::Buffer& fwBuffer
);
NATIVE_INT_TYPE m_fd; //!< file descriptor returned for I/O device

View File

@ -44,7 +44,7 @@ namespace Drv {
void LinuxSerialDriverComponentImpl ::
readBufferSend_handler(
const NATIVE_INT_TYPE portNum,
Fw::Buffer Buffer
Fw::Buffer& Buffer
)
{
this->m_readBuffMutex.lock();

View File

@ -45,7 +45,7 @@ namespace Drv {
startReadThread(NATIVE_INT_TYPE priority, NATIVE_INT_TYPE stackSize, NATIVE_INT_TYPE cpuAffinity) {
}
void LinuxSerialDriverComponentImpl::open(const char* const device, UartBaudRate baud, UartFlowControl fc, UartParity parity, bool block) {
bool LinuxSerialDriverComponentImpl::open(const char* const device, UartBaudRate baud, UartFlowControl fc, UartParity parity, bool block) {
}

View File

@ -16,6 +16,7 @@
|DR_OpenError|0 (0x0)|UART open error| | | | |
| | | |device|Fw::LogStringArg&|40|The device|
| | | |error|I32||The error code|
| | | |name|Fw::LogStringArg&|40|error string|
|DR_ConfigError|1 (0x1)|UART config error| | | | |
| | | |device|Fw::LogStringArg&|40|The device|
| | | |error|I32||The error code|

View File

@ -21,8 +21,11 @@ SRC_CYGWIN = LinuxSerialDriverComponentImpl.cpp
SRC_DARWIN = LinuxSerialDriverComponentImplStub.cpp
SRC_RASPIAN = LinuxSerialDriverComponentImpl.cpp
SRC_LINUXRT = LinuxSerialDriverComponentImpl.cpp
HDR = LinuxSerialDriverComponentImpl.hpp
SUBDIRS = test
SRC_LINUXRT = LinuxSerialDriverComponentImpl.cpp

View File

@ -73,10 +73,11 @@ namespace Drv {
}
this->m_bytes += readBuffer.getsize();
this->tlmWrite_SPI_Bytes(this->m_bytes);
return;
}
void LinuxSpiDriverComponentImpl::open(NATIVE_INT_TYPE device,
bool LinuxSpiDriverComponentImpl::open(NATIVE_INT_TYPE device,
NATIVE_INT_TYPE select,
SpiFrequency clock) {
@ -96,7 +97,7 @@ namespace Drv {
if (fd == -1) {
DEBUG_PRINT("open SPI device %d.%d failed. %d\n",device,select,errno);
this->log_WARNING_HI_SPI_OpenError(device,select,fd);
return;
return false;
} else {
DEBUG_PRINT("Successfully opened SPI device %s fd %d\n",devName,fd);
}
@ -112,7 +113,7 @@ namespace Drv {
if (ret == -1) {
DEBUG_PRINT("ioctl SPI_IOC_WR_MODE fd %d failed. %d\n",fd,errno);
this->log_WARNING_HI_SPI_ConfigError(device,select,ret);
return;
return false;
} else {
DEBUG_PRINT("SPI fd %d WR mode successfully configured to %d\n",fd,mode);
}
@ -121,7 +122,7 @@ namespace Drv {
if (ret == -1) {
DEBUG_PRINT("ioctl SPI_IOC_RD_MODE fd %d failed. %d\n",fd,errno);
this->log_WARNING_HI_SPI_ConfigError(device,select,ret);
return;
return false;
} else {
DEBUG_PRINT("SPI fd %d RD mode successfully configured to %d\n",fd,mode);
}
@ -134,7 +135,7 @@ namespace Drv {
if (ret == -1) {
DEBUG_PRINT("ioctl SPI_IOC_WR_BITS_PER_WORD fd %d failed. %d\n",fd,errno);
this->log_WARNING_HI_SPI_ConfigError(device,select,ret);
return;
return false;
} else {
DEBUG_PRINT("SPI fd %d WR bits per word successfully configured to %d\n",fd,bits);
}
@ -143,7 +144,7 @@ namespace Drv {
if (ret == -1) {
DEBUG_PRINT("ioctl SPI_IOC_RD_BITS_PER_WORD fd %d failed. %d\n",fd,errno);
this->log_WARNING_HI_SPI_ConfigError(device,select,ret);
return;
return false;
} else {
DEBUG_PRINT("SPI fd %d RD bits per word successfully configured to %d\n",fd,bits);
}
@ -155,7 +156,7 @@ namespace Drv {
if (ret == -1) {
DEBUG_PRINT("ioctl SPI_IOC_WR_MAX_SPEED_HZ fd %d failed. %d\n",fd,errno);
this->log_WARNING_HI_SPI_ConfigError(device,select,ret);
return;
return false;
} else {
DEBUG_PRINT("SPI fd %d WR freq successfully configured to %d\n",fd,clock);
}
@ -164,11 +165,13 @@ namespace Drv {
if (ret == -1) {
DEBUG_PRINT("ioctl SPI_IOC_RD_MAX_SPEED_HZ fd %d failed. %d\n",fd,errno);
this->log_WARNING_HI_SPI_ConfigError(device,select,ret);
return;
return false;
} else {
DEBUG_PRINT("SPI fd %d RD freq successfully configured to %d\n",fd,clock);
}
return true;
}
LinuxSpiDriverComponentImpl::~LinuxSpiDriverComponentImpl(void) {

View File

@ -68,7 +68,7 @@ namespace Drv {
~LinuxSpiDriverComponentImpl(void);
//! Open device
void open(NATIVE_INT_TYPE device,
bool open(NATIVE_INT_TYPE device,
NATIVE_INT_TYPE select,
SpiFrequency clock);

View File

@ -21,9 +21,12 @@ SRC_CYGWIN = LinuxSpiDriverComponentImpl.cpp
SRC_DARWIN = LinuxSpiDriverComponentImplStub.cpp
SRC_RASPIAN = LinuxSpiDriverComponentImpl.cpp
SRC_LINUXRT = LinuxSpiDriverComponentImpl.cpp
HDR = LinuxSpiDriverComponentImpl.hpp
SUBDIRS = test
SRC_LINUXRT = LinuxSpiDriverComponentImpl.cpp

View File

@ -5,7 +5,7 @@
# Define numbers of ports
ActiveRateGroupOutputPorts = 10 ; Number of rate group member output ports for ActiveRateGroup
CmdDispatcherComponentCommandPorts = 20 ; Used for command and registration ports
CmdDispatcherComponentCommandPorts = 30 ; Used for command and registration ports
CmdDispatcherSequencePorts = 5 ; Used for uplink/sequencer buffer/response ports
RateGroupDriverRateGroupPorts = 3 ; Used to drive rate groups
HealthPingPorts = 25 ; Used to ping active components

View File

@ -161,7 +161,7 @@
// Define max length of assert string
#ifndef FW_ASSERT_TEXT_SIZE
#define FW_ASSERT_TEXT_SIZE 80 //!< Size of string used to store assert description
#define FW_ASSERT_TEXT_SIZE 120 //!< Size of string used to store assert description
#endif
// Adjust various configuration parameters in the architecture. Some of the above enables may disable some of the values
@ -169,7 +169,7 @@
// The size of the object name stored in the object base class. Larger names will be truncated.
#if FW_OBJECT_NAMES
#ifndef FW_OBJ_NAME_MAX_SIZE
#define FW_OBJ_NAME_MAX_SIZE 80 //!< Size of object name (if object names enabled)
#define FW_OBJ_NAME_MAX_SIZE 120 //!< Size of object name (if object names enabled)
#endif
#endif
@ -242,7 +242,7 @@
// Specifies the maximum size of a string in a log event
#ifndef FW_LOG_STRING_MAX_SIZE
#define FW_LOG_STRING_MAX_SIZE 80 //!< Max size of log string parameter type
#define FW_LOG_STRING_MAX_SIZE 100 //!< Max size of log string parameter type
#endif
// Specifies the size of the buffer that contains the serialized telemetry value.

View File

@ -23,6 +23,8 @@ namespace Fw {
FW_PACKET_TELEM, // !< Telemetry packet type - outgoing
FW_PACKET_LOG, // !< Log type - outgoing
FW_PACKET_FILE, // !< File type - incoming and outgoing
FW_PACKET_PACKETIZED_TLM, // !< Packetized telemetry packet type
FW_PACKET_IDLE, // !< Idle packet
FW_PACKET_UNKNOWN = 0xFF // !< Unknown packet
} ComPacketType;

View File

@ -4,6 +4,8 @@
#include <Fw/Types/EightyCharString.hpp>
#include <stdio.h>
//#define DEBUG_PRINT(x,...) printf(x,##__VA_ARGS__); fflush(stdout)
#define DEBUG_PRINT(x,...)
namespace Fw {
@ -38,7 +40,7 @@ namespace Fw {
}
#endif
ActiveComponentBase::~ActiveComponentBase() {
DEBUG_PRINT("ActiveComponent %s destructor.\n",this->getObjName());
}
void ActiveComponentBase::init(NATIVE_INT_TYPE instance) {
@ -52,7 +54,7 @@ namespace Fw {
}
#endif
void ActiveComponentBase::start(NATIVE_INT_TYPE identifier, NATIVE_INT_TYPE priority, NATIVE_INT_TYPE stackSize) {
void ActiveComponentBase::start(NATIVE_INT_TYPE identifier, NATIVE_INT_TYPE priority, NATIVE_INT_TYPE stackSize, NATIVE_INT_TYPE cpuAffinity) {
Fw::EightyCharString taskName;
@ -64,8 +66,7 @@ namespace Fw {
taskName = taskNameChar;
#endif
Os::Task::TaskStatus status = this->m_task.start(taskName, identifier, priority, stackSize, this->s_baseTask,
this);
Os::Task::TaskStatus status = this->m_task.start(taskName, identifier, priority, stackSize, this->s_baseTask,this, cpuAffinity);
FW_ASSERT(status == Os::Task::TASK_OK,(NATIVE_INT_TYPE)status);
}
@ -73,8 +74,13 @@ namespace Fw {
ActiveComponentExitSerializableBuffer exitBuff;
SerializeStatus stat = exitBuff.serialize((I32)ACTIVE_COMPONENT_EXIT);
FW_ASSERT(FW_SERIALIZE_OK == stat,static_cast<NATIVE_INT_TYPE>(stat));
Os::Queue::QueueStatus qStat = this->m_queue.send(exitBuff,0,Os::Queue::QUEUE_NONBLOCKING);
FW_ASSERT(Os::Queue::QUEUE_OK == qStat,static_cast<NATIVE_INT_TYPE>(qStat));
(void)this->m_queue.send(exitBuff,0,Os::Queue::QUEUE_NONBLOCKING);
DEBUG_PRINT("exit %s\n", this->getObjName());
}
Os::Task::TaskStatus ActiveComponentBase::join(void **value_ptr) {
DEBUG_PRINT("join %s\n", this->getObjName());
return this->m_task.join(value_ptr);
}
void ActiveComponentBase::s_baseTask(void* ptr) {

View File

@ -19,8 +19,9 @@
namespace Fw {
class ActiveComponentBase : public QueuedComponentBase {
public:
void start(NATIVE_INT_TYPE identifier, NATIVE_INT_TYPE priority, NATIVE_INT_TYPE stackSize); //!< called by instantiator when task is to be started
void start(NATIVE_INT_TYPE identifier, NATIVE_INT_TYPE priority, NATIVE_INT_TYPE stackSize, NATIVE_INT_TYPE cpuAffinity = -1); //!< called by instantiator when task is to be started
void exit(void); //!< exit task in active component
Os::Task::TaskStatus join(void **value_ptr); //!< provide return value of thread if value_ptr is not NULL
enum {
ACTIVE_COMPONENT_EXIT //!< message to exit active component task

View File

@ -166,8 +166,8 @@ namespace Fw {
status = FW_DESERIALIZE_TYPE_MISMATCH;
break;
default:
status = static_cast<SerializeStatus>(0);
FW_ASSERT(0);
FW_ASSERT(0,status);
break;
}
return status;
}

View File

@ -99,6 +99,9 @@ namespace Fw {
//! The sequence index
U32 sequenceIndex;
//! Header size
enum { HEADERSIZE = sizeof(U8) + sizeof(sequenceIndex) };
PRIVATE:
//! Initialize a file packet header
@ -181,6 +184,12 @@ namespace Fw {
//! Pointer to the file data
const U8 *data;
//! header size
enum { HEADERSIZE = Header::HEADERSIZE +
sizeof(byteOffset) +
sizeof(dataSize) };
public:
//! Initialize a data packet

View File

@ -41,7 +41,7 @@ namespace Fw {
if (buff != this->m_buf) {
(void)strncpy(this->m_buf,buff,size);
// NULL terminate
this->terminate();
this->terminate(sizeof(this->m_buf));
}
}
@ -56,7 +56,7 @@ namespace Fw {
// deserialize string
SerializeStatus stat = buffer.deserialize((U8*)this->m_buf,maxSize);
// make sure it is null-terminated
this->terminate();
this->terminate(maxSize);
return stat;
}
@ -65,9 +65,9 @@ namespace Fw {
return FW_LOG_TEXT_BUFFER_SIZE;
}
void TextLogString::terminate(void) {
void TextLogString::terminate(NATIVE_UINT_TYPE size) {
// null terminate the string
this->m_buf[sizeof(this->m_buf)-1] = 0;
this->m_buf[size < sizeof(this->m_buf)?size:sizeof(this->m_buf)-1] = 0;
}
const TextLogString& TextLogString::operator=(const TextLogString& other) {

View File

@ -32,7 +32,7 @@ namespace Fw {
private:
void copyBuff(const char* buff, NATIVE_UINT_TYPE size);
NATIVE_UINT_TYPE getCapacity(void) const ;
void terminate(void); //!< terminate the string
void terminate(NATIVE_UINT_TYPE size); //!< terminate the string
char m_buf[FW_LOG_TEXT_BUFFER_SIZE];
};

Binary file not shown.

View File

@ -40,6 +40,15 @@ namespace Fw {
this->m_seconds = seconds;
}
const Time& Time::operator=(const Time& other) {
this->m_timeBase = other.m_timeBase;
this->m_timeContext = other.m_timeContext;
this->m_useconds = other.m_useconds;
this->m_seconds = other.m_seconds;
return other;
}
bool Time::operator==(const Time& other) const {
return (Time::compare(*this,other) == EQ);
}

View File

@ -39,6 +39,7 @@ namespace Fw {
bool operator<(const Time& other) const;
bool operator>=(const Time& other) const;
bool operator<=(const Time& other) const;
const Time& operator=(const Time& other);
// Static methods:
//! The type of a comparison result

View File

@ -12,7 +12,7 @@
#else
#if FW_ASSERT_LEVEL == FW_FILEID_ASSERT
#define fileIdFs "Assert file ID %d: Line: %d "
#define fileIdFs "Assert file ID 0x%08X: Line: %d "
#else
#define fileIdFs "Assert file \"%s\": Line: %d "
#endif

View File

@ -9,6 +9,7 @@
#define FWCASSERT_HPP_
#include <Fw/Cfg/Config.hpp>
#include <Fw/Types/BasicTypes.hpp>
#if FW_ASSERT_LEVEL == FW_NO_ASSERT
@ -28,9 +29,18 @@
(CAssert0((U8*)__FILE__, __LINE__))))
#endif
#ifdef __cplusplus
extern "C" {
#endif // __cplusplus
I32 CAssert0(FILE_NAME_ARG file, U32 lineNo); //!< C assert function
I32 CAssert1(FILE_NAME_ARG file, U32 lineNo, NATIVE_INT_TYPE arg1); //!< C assert function 1
#ifdef __cplusplus
} // extern "C"
#endif // __cplusplus
#endif // ASSERT is defined
#endif /* FWCASSERT_HPP_ */

50
Fw/Types/MmapAllocator.cpp Executable file
View File

@ -0,0 +1,50 @@
/**
* \file
* \author Gene Merewether
* \brief Implementation of mmap based allocator
*
* \copyright
* Copyright 2009-2016, by the California Institute of Technology.
* ALL RIGHTS RESERVED. United States Government Sponsorship
* acknowledged. Any commercial use must be negotiated with the Office
* of Technology Transfer at the California Institute of Technology.
*
* This software may be subject to U.S. export control laws and
* regulations. By accepting this document, the user agrees to comply
* with all U.S. export laws and regulations. User has the
* responsibility to obtain export licenses, or other export authority
* as may be required before exporting such information to foreign
* countries or providing access to foreign persons.
*/
#include <Fw/Types/MmapAllocator.hpp>
#include <stdlib.h>
#include <sys/mman.h>
#include <Fw/Types/Assert.hpp>
namespace Fw {
MmapAllocator::MmapAllocator() : m_length(0) {
}
MmapAllocator::~MmapAllocator() {
}
void *MmapAllocator::allocate(NATIVE_UINT_TYPE identifier, NATIVE_UINT_TYPE size) {
void* addr = mmap(NULL, size, PROT_READ | PROT_WRITE,
MAP_SHARED | MAP_ANONYMOUS, -1, 0);
if (addr == MAP_FAILED) {
return NULL;
}
this->m_length = size;
return addr;
}
void MmapAllocator::deallocate(NATIVE_UINT_TYPE identifier, void* ptr) {
if (this->m_length) {
int stat = munmap(ptr, this->m_length);
FW_ASSERT(stat == 0, stat);
}
}
} /* namespace Fw */

40
Fw/Types/MmapAllocator.hpp Executable file
View File

@ -0,0 +1,40 @@
/**
* \file
* \author Gene Merewether
* \brief A MemAllocator implementation class that uses mmap.
*
* \copyright
* Copyright 2009-2016, by the California Institute of Technology.
* ALL RIGHTS RESERVED. United States Government Sponsorship
* acknowledged. Any commercial use must be negotiated with the Office
* of Technology Transfer at the California Institute of Technology.
*
* This software may be subject to U.S. export control laws and
* regulations. By accepting this document, the user agrees to comply
* with all U.S. export laws and regulations. User has the
* responsibility to obtain export licenses, or other export authority
* as may be required before exporting such information to foreign
* countries or providing access to foreign persons.
*/
#ifndef TYPES_MMAPALLOCATOR_HPP_
#define TYPES_MMAPALLOCATOR_HPP_
#include <Fw/Types/MemAllocator.hpp>
namespace Fw {
class MmapAllocator: public MemAllocator {
public:
MmapAllocator();
virtual ~MmapAllocator();
void *allocate(NATIVE_UINT_TYPE identifier, NATIVE_UINT_TYPE size);
void deallocate(NATIVE_UINT_TYPE identifier, void* ptr);
private:
NATIVE_UINT_TYPE m_length;
};
} /* namespace Fw */
#endif /* TYPES_MMAPALLOCATOR_HPP_ */

View File

@ -403,7 +403,7 @@ namespace Fw {
SerializeStatus PolyType::serialize(SerializeBufferBase& buffer) const {
// store type
SerializeStatus stat = buffer.serialize(static_cast<I32> (this->m_dataType));
SerializeStatus stat = buffer.serialize(static_cast<FwEnumStoreType> (this->m_dataType));
// switch on type
switch (this->m_dataType) {
@ -459,7 +459,7 @@ namespace Fw {
SerializeStatus PolyType::deserialize(SerializeBufferBase& buffer) {
// get type
I32 des;
FwEnumStoreType des;
SerializeStatus stat = buffer.deserialize(des);
if (stat != FW_SERIALIZE_OK) {

View File

@ -150,7 +150,7 @@ namespace Fw {
enum {
SERIALIZED_TYPE_ID = FW_TYPEID_POLY, //!< typeid for PolyType
SERIALIZED_SIZE = sizeof(Type) + sizeof(PolyVal) + sizeof(NATIVE_INT_TYPE) //!< stored serialized size
SERIALIZED_SIZE = sizeof(FwEnumStoreType) + sizeof(PolyVal) //!< stored serialized size
};

View File

@ -599,6 +599,19 @@ namespace Fw {
this->m_deserLoc = 0;
}
SerializeStatus SerializeBufferBase::deserializeSkip(NATIVE_UINT_TYPE numBytesToSkip)
{
// check for room
if (this->getBuffLength() == this->m_deserLoc) {
return FW_DESERIALIZE_BUFFER_EMPTY;
} else if (this->getBuffLength() - this->m_deserLoc < numBytesToSkip) {
return FW_DESERIALIZE_SIZE_MISMATCH;
}
// update location in buffer to skip the value
this->m_deserLoc += numBytesToSkip;
return FW_SERIALIZE_OK;
}
NATIVE_UINT_TYPE SerializeBufferBase::getBuffLength(void) const {
return this->m_serLoc;
}
@ -644,6 +657,25 @@ namespace Fw {
}
SerializeStatus SerializeBufferBase::copyRawOffset(SerializeBufferBase& dest, NATIVE_UINT_TYPE size) {
// make sure there is sufficient size in destination
if (dest.getBuffCapacity() < size + dest.getBuffLength()) {
return FW_SERIALIZE_NO_ROOM_LEFT;
}
// make sure there is sufficient buffer in source
if (this->getBuffLeft() < size) {
return FW_DESERIALIZE_SIZE_MISMATCH;
}
// otherwise, serialize bytes to destination without writing length
SerializeStatus stat = dest.serialize(&this->getBuffAddr()[this->m_deserLoc], size, true);
if (stat == FW_SERIALIZE_OK) {
this->m_deserLoc += size;
}
return stat;
}
// return address of buffer not yet deserialized. This is used
// to copy the remainder of a buffer.
const U8* SerializeBufferBase::getBuffAddrLeft(void) const {

View File

@ -117,6 +117,7 @@ namespace Fw {
void resetSer(void); //!< reset to beginning of buffer to reuse for serialization
void resetDeser(void); //!< reset deserialization to beginning
SerializeStatus deserializeSkip(NATIVE_UINT_TYPE numBytesToSkip); //!< Skips the number of specified bytes for deserialization
virtual NATIVE_UINT_TYPE getBuffCapacity(void) const = 0; //!< returns capacity, not current size, of buffer
NATIVE_UINT_TYPE getBuffLength() const; //!< returns current buffer size
NATIVE_UINT_TYPE getBuffLeft() const; //!< returns how much deserialization buffer is left
@ -128,6 +129,9 @@ namespace Fw {
SerializeStatus setBuffLen(NATIVE_UINT_TYPE length); //!< sets buffer length manually after filling with data
SerializeStatus copyRaw(SerializeBufferBase& dest, NATIVE_UINT_TYPE size); //!< directly copies buffer without looking for a size in the stream.
// Will increment deserialization pointer
SerializeStatus copyRawOffset(SerializeBufferBase& dest, NATIVE_UINT_TYPE size); //!< directly copies buffer without looking for a size in the stream.
// Will increment deserialization pointer
#ifdef BUILD_UT
bool operator==(const SerializeBufferBase& other) const;

View File

@ -235,6 +235,41 @@ TEST(SerializationTest,Serialization1) {
printf("Val: in: %s out: %s stat1: %d stat2: %d\n",
boolt1 ? "TRUE" : "FALSE", boolt2 ? "TRUE" : "FALSE", stat1, stat2);
printf("Skip deserialization Tests\n");
#endif
// Test skipping:
buff.resetSer();
stat1 = buff.serialize(u32t1);
ASSERT_EQ(Fw::FW_SERIALIZE_OK,stat1);
stat2 = buff.serialize(u32t2);
ASSERT_EQ(Fw::FW_SERIALIZE_OK,stat2);
// should fail:
stat1 = buff.deserializeSkip(10);
ASSERT_EQ(Fw::FW_DESERIALIZE_SIZE_MISMATCH,stat1);
// skip everything:
stat1 = buff.deserializeSkip(4);
ASSERT_EQ(Fw::FW_SERIALIZE_OK,stat1);
stat2 = buff.deserializeSkip(4);
ASSERT_EQ(Fw::FW_SERIALIZE_OK,stat2);
// should fail:
stat1 = buff.deserializeSkip(4);
ASSERT_EQ(Fw::FW_DESERIALIZE_BUFFER_EMPTY,stat1);
// skip half/read half:
buff.resetDeser();
stat1 = buff.deserializeSkip(4);
ASSERT_EQ(Fw::FW_SERIALIZE_OK,stat1);
U32 u32val;
stat2 = buff.deserialize(u32val);
ASSERT_EQ(Fw::FW_SERIALIZE_OK,stat2);
ASSERT_EQ(u32t2,u32val);
#if DEBUG_VERBOSE
printf("\nDeserialization Tests\n");
#endif

View File

@ -15,28 +15,28 @@ import socket
import struct
import time
from controllers import client_sock
from fprime.gse.controllers import client_sock
# Import the types this way so they do not need prefixing for execution.
from models.serialize.type_exceptions import *
from models.serialize.type_base import *
from fprime.gse.models.serialize.type_exceptions import *
from fprime.gse.models.serialize.type_base import *
from models.serialize.bool_type import *
from models.serialize.enum_type import *
from models.serialize.f32_type import *
from models.serialize.f64_type import *
from fprime.gse.models.serialize.bool_type import *
from fprime.gse.models.serialize.enum_type import *
from fprime.gse.models.serialize.f32_type import *
from fprime.gse.models.serialize.f64_type import *
from models.serialize.u8_type import *
from models.serialize.u16_type import *
from models.serialize.u32_type import *
from models.serialize.u64_type import *
from fprime.gse.models.serialize.u8_type import *
from fprime.gse.models.serialize.u16_type import *
from fprime.gse.models.serialize.u32_type import *
from fprime.gse.models.serialize.u64_type import *
from models.serialize.i8_type import *
from models.serialize.i16_type import *
from models.serialize.i32_type import *
from models.serialize.i64_type import *
from fprime.gse.models.serialize.i8_type import *
from fprime.gse.models.serialize.i16_type import *
from fprime.gse.models.serialize.i32_type import *
from fprime.gse.models.serialize.i64_type import *
from models.serialize.string_type import *
from models.serialize.serializable_type import *
from fprime.gse.models.serialize.string_type import *
from fprime.gse.models.serialize.serializable_type import *

View File

@ -16,8 +16,8 @@ import errno
import time
import logging
from utils import Logger
from models.serialize.type_base import *
from fprime.gse.utils import Logger
from fprime.gse.models.serialize.type_base import *
from optparse import OptionParser
__version__ = 0.1
@ -45,7 +45,7 @@ def signal_handler(signal, frame):
def now():
return time.ctime(time.time())
class ThreadedTCPRequestHandler(SocketServer.BaseRequestHandler):
class ThreadedTCPRequestHandler(SocketServer.StreamRequestHandler):
"""
Derived from original Stable demo during R&TD and adapted
for use in new FSW gse.py applicaiton.
@ -61,7 +61,8 @@ class ThreadedTCPRequestHandler(SocketServer.BaseRequestHandler):
Any client that sends a "List" comment makes the server display all
registered clients.
"""
SocketServer.BaseRequestHandler.allow_reuse_address = True
SocketServer.StreamRequestHandler.allow_reuse_address = True
SocketServer.StreamRequestHandler.timeout = 1
def handle(self): # on each client connect
"""
@ -187,9 +188,12 @@ class ThreadedTCPRequestHandler(SocketServer.BaseRequestHandler):
elif header == "Quit":
LOCK.acquire()
print "Quit received!"
SERVER.dest_obj[self.name].put(struct.pack(">I", 0xA5A5A5A5))
shutdown_event.set()
time.sleep(1)
print "Quit processed!"
SERVER.shutdown()
SERVER.server_close()
shutdown_event.set()
LOCK.release()
break
@ -215,6 +219,11 @@ class ThreadedTCPRequestHandler(SocketServer.BaseRequestHandler):
return ''
msg = msg + chunk
n = len(msg)
except socket.timeout:
if shutdown_event.is_set():
print "socket timed out and shutdown is requested"
return "Quit\n"
continue
except socket.error, err:
if err.errno == errno.ECONNRESET:
print "Socket error " + str(err.errno) + " (Connection reset by peer) occurred on recv()."
@ -269,7 +278,7 @@ class ThreadedTCPRequestHandler(SocketServer.BaseRequestHandler):
data = tlm_packet_size + self.recv(size)
else:
raise RuntimeError("unrecognized client")
raise RuntimeError("unrecognized client %s"%dst)
return data
@ -305,10 +314,11 @@ class ThreadedTCPRequestHandler(SocketServer.BaseRequestHandler):
elif 'FSW' in dst:
dest_list = FSW_clients
for dest_elem in dest_list:
#print "Locking TCP"
LOCK.acquire()
if dest_elem in SERVER.dest_obj.keys():
# Send the message here....
#print "Sending msg to ", dest_elem
#print "Sending TCP msg to ", dest_elem
SERVER.dest_obj[dest_elem].put(data)
LOCK.release()
@ -414,7 +424,7 @@ class ThreadedUDPRequestHandler(SocketServer.BaseRequestHandler):
LOCK.acquire()
if dest_elem in SERVER.dest_obj.keys():
# Send the message here....
#print "Sending msg to ", dest_elem
#print "Sending UDP msg to ", dest_elem
SERVER.dest_obj[dest_elem].put(data)
LOCK.release()
@ -514,8 +524,10 @@ def main(argv=None):
#print "Process ID: %s" % p
while not shutdown_event.is_set():
server_thread.join(timeout = 1.0)
udp_server_thread.join(timeout = 1.0)
server_thread.join(timeout = 5.0)
udp_server_thread.join(timeout = 5.0)
print "shutdown from main thread"
SERVER.shutdown()
SERVER.server_close()

View File

@ -9,11 +9,11 @@ import tkFileDialog
from optparse import OptionParser
from utils import ConfigManager
from controllers import channel_loader
from models.tpe_models import SessionModel
from controllers.tpe_controllers import SessionController
from controllers.exceptions import GseControllerUndefinedDirectoryException
from fprime.gse.utils import ConfigManager
from fprime.gse.controllers import channel_loader
from fprime.gse.models.tpe_models import SessionModel
from fprime.gse.controllers.tpe_controllers import SessionController
from fprime.gse.controllers.exceptions import GseControllerUndefinedDirectoryException
# Setup logging
Logger = logging.getLogger(__name__)

View File

@ -17,7 +17,7 @@ import Pmw
import struct
import math
import time
from controllers import client_sock
from fprime.gse.controllers import client_sock
#import ModeMgrSm

21
Gse/bin/gse.py Normal file → Executable file
View File

@ -22,15 +22,15 @@ import Pmw
import time
import glob
import random
from utils import Logger
from utils import PortFinder
from utils import ConfigManager
from fprime.gse.utils import Logger
from fprime.gse.utils import PortFinder
from fprime.gse.utils import ConfigManager
import controllers.exceptions
import fprime.gse.controllers.exceptions
import traceback
from views import main_panel_factory
from views import main_panel
from fprime.gse.views import main_panel_factory
from fprime.gse.views import main_panel
from optparse import OptionParser
__all__ = []
@ -176,6 +176,10 @@ def main(argv=None):
#default=50007)
#default=PortFinder.old_getport(50000,[]))
)
parser.add_option("-s", "--stream_port", dest="stream_port", action="store", type="int", help="Set streaming socket server port [default: %default]", \
#default=50007)
#default=PortFinder.old_getport(50000,[]))
)
parser.add_option("-e", "--execute", dest="exec_app", action="store", type="string", help="Execute the specified fsw application after socket server and UI are up [default: %default]", \
default=fsw_app)
parser.add_option("-L", "--log-file-path", dest="log_file_path", action="store", type="string", help="Path to log files [default: %default]", \
@ -188,6 +192,9 @@ def main(argv=None):
default="local")
parser.add_option("-n", "--no-about", dest="no_about", action="store_true", help="Do not show about text screen on start", \
default=True)
parser.add_option("-t", "--title", dest="title", action="store",type="string", help="Set GUI title", default="Fprime")
parser.add_option("-x", "--packetspec", dest="packetspec", action="store",type="string", help="Path to packet specification file", default=None)
#parser.add_option("-v", "--verbose", dest="verbose", action="count", help="set verbosity level [default: %default]")
@ -263,7 +270,7 @@ def main(argv=None):
root.after(1000, execute, opts)
root.mainloop()
except controllers.exceptions.GseControllerException, e:
except fprime.gse.controllers.exceptions.GseControllerException, e:
sys.stderr.write("Exception: %s\n"%e.getMsg())
traceback.print_exc()
return 2

View File

@ -3,7 +3,7 @@
import os
import sys
import time
from utils.gse_api import GseApi
from fprime.gse.utils.gse_api import GseApi
from optparse import OptionParser
__version__ = 0.1

View File

@ -3,7 +3,7 @@
import os
import sys
#from gse_api import GseApi
from utils.gse_api import GseApi
from fprime.gse.utils.gse_api import GseApi
from optparse import OptionParser
__version__ = 0.1

View File

@ -32,8 +32,11 @@ def process_poller():
try:
child.expect('\r\n',timeout=1)
if exitThread:
try:
child.kill(signal.SIGINT)
child.wait()
except:
print("KILL")
break
if len(child.before):
text_queue.put(child.before)
@ -44,8 +47,11 @@ def process_poller():
break
except pexpect.TIMEOUT:
if exitThread:
try:
child.kill(signal.SIGINT)
child.wait()
except:
print("KILL")
break
if len(child.before):
text_queue.put(child.before)

View File

@ -6,3 +6,6 @@ multiprocess
pexpect
Pmw
tkintertable
pyzmq
numpy
pillow

4
Gse/bin/run_cmds.py Normal file → Executable file
View File

@ -3,7 +3,7 @@
import os
import sys
import time
from utils.gse_api import GseApi
from fprime.gse.utils.gse_api import GseApi
from optparse import OptionParser
__version__ = 0.1
@ -47,7 +47,7 @@ def main(argv=None):
sys.stderr.write(indent + " for help use --help\n")
return 2
api = GseApi(generated_path=opts.generated_path, port=opts.port, server_addr=opts.addr)
api = GseApi(generated_path=opts.generated_path, port=opts.port, server_addr=opts.addr, verbose=True)
# process each of the files
for script in args:

45
Gse/bin/tinyseqgen.py Normal file → Executable file
View File

@ -19,6 +19,8 @@ import os
import copy
from datetime import datetime, timedelta
from fprime.gse.models.serialize.type_exceptions import *
__author__ = "Kevin Dinkel"
__copyright__ = "Copyright 2015, California Institute of Technology."
__version__ = "1.0"
@ -33,10 +35,10 @@ def __error(string):
sys.exit(1)
# try:
from models.common.command import Descriptor
from views.seq_panel import SeqBinaryWriter
from controllers import command_loader
from controllers import exceptions as gseExceptions
from fprime.gse.models.common.command import Descriptor
from fprime.gse.views.seq_panel import SeqBinaryWriter
from fprime.gse.controllers import command_loader
from fprime.gse.controllers import exceptions as gseExceptions
# except:
# __error("The Gse source code was not found in your $PYTHONPATH variable. Please set PYTHONPATH to something like: $BUILD_ROOT/Gse/src:$BUILD_ROOT/Gse/generated/$DEPLOYMENT_NAME")
@ -122,10 +124,14 @@ def __parse(seqfile):
# If the string contains a "." assume that it is a float:
elif "." in arg:
return float(arg)
elif arg == 'True' or arg == 'true' or arg == 'TRUE':
return True
elif arg == 'False' or arg == 'false' or arg == 'FALSE':
return False
else:
try:
# See if it translates to an integer:
return int(arg)
return int(arg,0)
except ValueError:
try:
# See if it translates to a float:
@ -230,7 +236,7 @@ def __parse(seqfile):
__errorLine(i, "Encountered sytax error parsing arguments")
yield i, descriptor, seconds, useconds, mnemonic, args
def generateSequence(inputFile, outputFile=None):
def generateSequence(inputFile, outputFile=None, timebase=0xffff):
'''
Write a binary sequence file from a text sequence file
@param inputFile: A text input sequence file name (usually a .seq extension)
@ -242,15 +248,15 @@ def generateSequence(inputFile, outputFile=None):
generated_command_path = generated_path + "/commands"
except:
__error("Environment variable 'GSE_GENERATED_PATH' not set. It should be set to something like '$BUILD_ROOT/Gse/generated/$DEPLOYMENT' and also added to $PYTHONPATH.")
command_loader = command_loader.CommandLoader.getInstance()
cmds = command_loader.CommandLoader.getInstance()
try:
command_loader.create(generated_command_path)
cmds.create(generated_command_path)
except gseExceptions.GseControllerUndefinedDirectoryException:
__error("Environment variable 'GSE_GENERATED_PATH' is set to '" + generated_path + "'. This is not a valid directory. Make sure this variable is set correctly, and the GSE python deployment autocode as been installed in this location.")
# Parse the input file:
command_list = []
command_obj_dict = command_loader.getCommandDict()
command_obj_dict = cmds.getCommandDict()
for i, descriptor, seconds, useconds, mnemonic, args in __parse(inputFile):
# Make sure that command is in the command dictionary:
if mnemonic in command_obj_dict:
@ -272,7 +278,7 @@ def generateSequence(inputFile, outputFile=None):
__errorLine(i, "'" + mnemonic + "' does not match any command in the command dictionary.")
# Write to the output file:
writer = SeqBinaryWriter()
writer = SeqBinaryWriter(timebase=timebase)
if not outputFile:
outputFile = os.path.splitext(inputFile)[0] + ".bin"
try:
@ -287,8 +293,21 @@ if __name__ == "__main__":
The main program if run from the commandline. Note that this file can also be used
as a module by calling the generateSequence() function
'''
if len(sys.argv) == 2 or len(sys.argv) == 3:
generateSequence(*sys.argv[1:])
timebase = 0xffff
good = False
args = copy.copy(sys.argv[1:])
try:
if "-t" in args:
index = args.index("-t")
timebase = int(args[index + 1], 0)
args = args[:index] + args[index + 2:]
good = True
except ValueError:
print "Could not parse time base: {0}".format(args[index + 1])
except IndexError:
print "No time base argument supplied to '-t' argument"
if (len(args) == 1 or len(args) == 2) and good:
generateSequence(*args, timebase=timebase)
else:
print "Usage: tinyseqgen sequence_file_in.seq [binary_sequence_file_out.bin]"
print
@ -297,6 +316,8 @@ if __name__ == "__main__":
print "Description: tinyseqgen takes a simple input sequence format (.seq),"
print "and outputs a binary command sequence loadable by the Svc/SequenceFileLoader."
print
print " -t <time base>: time base, set the time base integer. Defaults to: 0xFFFF"
print
print "Here, try out this example input sequence file (simple_sequence.seq):"
print
print ";--------------------------------------------------------------------"

View File

@ -1,145 +0,0 @@
#!/bin/env python
#===============================================================================
# NAME: CommandLoader.py
#
# DESCRIPTION: This module contains a singleton for loading automatically
# generated Python descriptor files.
#
# AUTHOR: reder
# EMAIL: reder@jpl.nasa.gov
# DATE CREATED : Jan. 9, 2015
#
# Copyright 2015, California Institute of Technology.
# ALL RIGHTS RESERVED. U.S. Government Sponsorship acknowledged.
#===============================================================================
#
# Python standard modules
#
import glob
import os
import sys
from controllers import exceptions
from models.common import command
from models.serialize import enum_type
class CommandLoader(object):
'''
Singleton loader class used to capture commands descriptor
files and instance Command objects. The objects are
then stored in a dictionary of form { MNEMONIC : Command Instance }
so the views can all use this for initialization.
'''
__instance = None
def __init__(self):
'''
Constructor
'''
# Main dictionaries with key always mnemonic name.
self.__dict_component = dict()
self.__dict_opcode = dict()
self.__dict_desc = dict()
self.__dict_args = dict()
self.__dict_commands = dict()
self.__dict_commands_by_id = dict()
def getInstance():
"""
Return instance of singleton.
"""
if(CommandLoader.__instance is None):
CommandLoader.__instance = CommandLoader()
return CommandLoader.__instance
#define static method
getInstance = staticmethod(getInstance)
#@todo: refactor using the module_loader decorator here...
def create(self, generated_command_path):
"""
Generate all the dictionaries and instances of Command here...
"""
# First add generated/commands to the python path
if not os.path.isdir(generated_command_path):
raise exceptions.GseControllerUndefinedDirectoryException(generated_command_path)
sys.path.append(generated_command_path)
# Get the modules
cmd_modules = glob.glob(generated_command_path + os.sep + '*.py')
# Iterate over them and import them
#
file_list = []
for cmd_imp in cmd_modules:
fi = os.path.split(cmd_imp)[-1]
if fi != "__init__.py":
file_list.append(fi)
# Import the modules here
#
module_list = []
for m in file_list:
m = m[:-3]
exec("import %s" % m)
module_list.append(m)
# Generate required dictionaries here
#
for m in module_list:
m2 = eval("%s.MNEMONIC" % m)
if m != m2:
raise exceptions.GseControllerMnemonicMismatchException(m, m2)
self.__dict_component[m] = eval("%s.COMPONENT" % m)
self.__dict_opcode[m] = eval("%s.OP_CODE" % m)
self.__dict_desc[m] = eval("%s.CMD_DESCRIPTION" % m)
self.__dict_args[m] = eval("%s.ARGUMENTS" % m)
#
# Instance Command objects here...
#
self.__dict_commands[m] = \
command.Command(self.__dict_component[m], \
m, \
self.__dict_opcode[m], \
self.__dict_desc[m], \
self.__dict_args[m])
for mnemonic in self.__dict_commands.keys():
cmd_args = self.__dict_commands[mnemonic].getArgs()
new_cmd_args = cmd_args
# update the command objects if necessary
for i in range(len(cmd_args)):
if type(cmd_args[i][2]) == type(enum_type.EnumType()):
typename = cmd_args[i][2].typename()
enum_dict = cmd_args[i][2].enum_dict()
val = cmd_args[i][2].enum_dict().keys()[0]
new_enum_obj = enum_type.EnumType(typename, enum_dict, val)
new_cmd_args[i] = (new_cmd_args[i][0],new_cmd_args[i][1],new_enum_obj)
for name, id in self.__dict_opcode.iteritems():
self.__dict_commands_by_id[id] = self.__dict_commands[name]
def getComponentsDict(self):
return self.__dict_component
def getOpCodeDict(self):
return self.__dict_opcode
def getDescDict(self):
return self.__dict_desc
def getArgsDict(self):
return self.__dict_args
def getCommandDict(self):
return self.__dict_commands
def setCommandDict(self, cmd_dict):
self.__dict_commands = cmd_dict
def getCommandObj(self, mnemonic):
return self.__dict_commands[mnemonic]
def setCommandObj(self, mnemonic, obj):
self.__dict_commands[mnemonic] = obj
def getCommandObjById(self, id):
return self.__dict_commands_by_id[id]

View File

@ -0,0 +1,2 @@
#Python 2/3 compatibility for namespace packages
__path__ = __import__('pkgutil').extend_path(__path__, __name__)

Some files were not shown because too many files have changed in this diff Show More