Skip to content

Commit c2e1bfd

Browse files
authored
Change table component MIME type to text/csv (#1491)
With this change OMSimulator will support a subset of the proposed MA-CSV standard for stimuli data. The proposal requires MIME type text/csv for csv component, whereas OMSimulator previously used application/table. This commit ensures text/csv is used for export of SSPs. Importing SSPs supports both the previous MIME type (to ensure compatibility with SSPs exported in previous versions of OMSimulator) and the text/csv MIME type.
1 parent e3a3aeb commit c2e1bfd

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

src/OMSimulatorLib/ComponentTable.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,8 @@ oms::Component* oms::ComponentTable::NewComponent(const pugi::xml_node& node, om
110110
std::string type = node.attribute("type").as_string();
111111
std::string source = node.attribute("source").as_string();
112112

113-
if (type != "application/table")
113+
// Support both "legacy" application/table MIME type and text/csv according to MA-CSV proposal
114+
if (type != "application/table" && type != "text/csv")
114115
{
115116
logError("Unexpected component type: " + type);
116117
return NULL;
@@ -164,7 +165,7 @@ oms::Component* oms::ComponentTable::NewComponent(const pugi::xml_node& node, om
164165
oms_status_enu_t oms::ComponentTable::exportToSSD(pugi::xml_node& node, Snapshot& snapshot, std::string variantName) const
165166
{
166167
node.append_attribute("name") = this->getCref().c_str();
167-
node.append_attribute("type") = "application/table";
168+
node.append_attribute("type") = "text/csv";
168169
node.append_attribute("source") = getPath().c_str();
169170
pugi::xml_node node_connectors = node.append_child(oms::ssp::Draft20180219::ssd::connectors);
170171

src/OMSimulatorLib/System.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -907,7 +907,7 @@ oms_status_enu_t oms::System::importFromSnapshot(const pugi::xml_node& node, con
907907
else
908908
return logError("wrong xml schema detected: " + name);
909909
}
910-
else if ("application/table" == type)
910+
else if ("application/table" == type || "text/csv" == type)
911911
component = ComponentTable::NewComponent(*itElements, this, sspVersion, snapshot);
912912
#if !defined(NO_TLM)
913913
else if (itElements->attribute("type") == nullptr && getType() == oms_system_tlm) {

0 commit comments

Comments
 (0)