From 2330cc824c22f296075dbab35e7b5bcd02cf8c77 Mon Sep 17 00:00:00 2001 From: "Matthias P. Braendli" Date: Fri, 7 Feb 2014 14:18:18 +0100 Subject: add figtype and address parameters for packet components --- src/ParserConfigfile.cpp | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'src') diff --git a/src/ParserConfigfile.cpp b/src/ParserConfigfile.cpp index 947bd64..9468a32 100644 --- a/src/ParserConfigfile.cpp +++ b/src/ParserConfigfile.cpp @@ -349,6 +349,10 @@ void parse_configfile(string configuration_file, throw runtime_error(ss.str()); } + int figType = pt_comp.get("figtype", -1); + int packet_address = pt_comp.get("address", -1); + uint8_t component_type = pt_comp.get("type", 0); + dabComponent* component = new dabComponent(); memset(component, 0, sizeof(dabComponent)); @@ -357,6 +361,7 @@ void parse_configfile(string configuration_file, component->serviceId = service->id; component->subchId = subchannel->id; component->SCIdS = SCIdS_per_service[service]++; + component->type = component_type; try { string label = pt_comp.get("label"); @@ -379,6 +384,33 @@ void parse_configfile(string configuration_file, "Component with uid %s has no short label.\n", componentuid.c_str()); } + if (figType != -1) { + if (! component->isPacketComponent(ensemble->subchannels)) { + stringstream ss; + ss << "Component with uid " << componentuid << " is not packet, cannot have figtype defined !"; + throw runtime_error(ss.str()); + } + + if (figType >= (1<<12)) { + stringstream ss; + ss << "Component with uid " << componentuid << ": figtype '" << figType << "' is too large !"; + throw runtime_error(ss.str()); + } + + component->packet.appType = figType; + } + + if (packet_address != -1) { + if (! component->isPacketComponent(ensemble->subchannels)) { + stringstream ss; + ss << "Component with uid " << componentuid << " is not packet, cannot have address defined !"; + throw runtime_error(ss.str()); + } + + component->packet.address = packet_address; + } + + ensemble->components.push_back(component); } -- cgit v1.2.3