diff options
author | Matthias P. Braendli <matthias.braendli@mpb.li> | 2014-02-07 14:18:18 +0100 |
---|---|---|
committer | Matthias P. Braendli <matthias.braendli@mpb.li> | 2014-02-07 14:18:18 +0100 |
commit | 2330cc824c22f296075dbab35e7b5bcd02cf8c77 (patch) | |
tree | 02147bd46bb1131e56aa20d409a85b6b9a7f379e /src/ParserConfigfile.cpp | |
parent | 8a93130b066efd90f5b7d775cb1b5812e7677863 (diff) | |
download | dabmux-2330cc824c22f296075dbab35e7b5bcd02cf8c77.tar.gz dabmux-2330cc824c22f296075dbab35e7b5bcd02cf8c77.tar.bz2 dabmux-2330cc824c22f296075dbab35e7b5bcd02cf8c77.zip |
add figtype and address parameters for packet components
Diffstat (limited to 'src/ParserConfigfile.cpp')
-rw-r--r-- | src/ParserConfigfile.cpp | 32 |
1 files changed, 32 insertions, 0 deletions
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<int>("figtype", -1); + int packet_address = pt_comp.get<int>("address", -1); + uint8_t component_type = pt_comp.get<uint8_t>("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<string>("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); } |