53 if(!platformNEMMap_.insert(std::make_pair(pNEM->getNEMId(),std::move(pNEM))).second)
55 throw makeException<PlatformException>(
"NEMManagerImpl: Multiple NEMs with id" 68 "IPv4 or IPv6 Event Service channel multicast endpoint.");
70 configRegistrar.registerNonNumeric<std::string>(
"eventservicedevice",
73 "Device to associate with the Event Service channel multicast endpoint.");
75 configRegistrar.registerNumeric<std::uint8_t>(
"eventservicettl",
78 "Device to associate with the Event Service channel multicast endpoint.");
80 configRegistrar.registerNonNumeric<
INETAddr>(
"otamanagergroup",
83 "IPv4 or IPv6 Event Service OTA channel endpoint.");
85 configRegistrar.registerNonNumeric<std::string>(
"otamanagerdevice",
88 "Device to associate with the OTA channel multicast endpoint.");
90 configRegistrar.registerNumeric<std::uint8_t>(
"otamanagerttl",
93 "OTA channel multicast message TTL.");
96 configRegistrar.registerNumeric<
bool>(
"otamanagerloopback",
99 "Enable multicast loopback on the OTA channel multicast channel.");
101 configRegistrar.registerNumeric<
bool>(
"otamanagerchannelenable",
104 "Enable OTA channel multicast communication.");
107 configRegistrar.registerNonNumeric<
INETAddr>(
"controlportendpoint",
110 "IPv4 or IPv6 control port endpoint.");
112 configRegistrar.registerNonNumeric<std::string>(
"antennaprofilemanifesturi",
115 "Absolute URI of the antenna profile manifest to load." 116 " The antenna profile manifest contains a list of" 117 " antenna profile entries. Each entry contains a unique" 118 " profile identifier, an antenna pattern URI and an" 119 " antenna blockage URI. This parameter is required when" 120 " antennaprofileenable is on or if any other NEM" 121 " participating in the emulation has antennaprofileenable" 122 " set on, even in the case where antennaprofileenable is" 125 configRegistrar.registerNumeric<std::uint32_t>(
"stats.ota.maxpacketcountrows",
128 "OTA channel max packet count table rows.");
130 configRegistrar.registerNumeric<std::uint32_t>(
"stats.ota.maxeventcountrows",
133 "OTA channel max event count table rows.");
135 configRegistrar.registerNumeric<std::uint32_t>(
"stats.event.maxeventcountrows",
138 "Event channel max event count table rows.");
144 for(
const auto & item : update)
146 if(item.first ==
"otamanagergroup")
148 OTAManagerGroupAddr_ = item.second[0].asINETAddr();
152 "NEMManagerImpl::configure OTA Manager Channel Group: %s",
153 OTAManagerGroupAddr_.
str().c_str());
156 else if(item.first ==
"otamanagerdevice")
158 sOTAManagerGroupDevice_ = item.second[0].asString();
162 "NEMManagerImpl::configure %s: %s",
164 sOTAManagerGroupDevice_.c_str());
167 else if(item.first ==
"otamanagerttl")
169 u8OTAManagerTTL_ = item.second[0].asUINT8();
173 "NEMManagerImpl::configure %s: %hhu",
177 else if(item.first ==
"otamanagerloopback")
179 bOTAManagerChannelLoopback_ = item.second[0].asBool();
183 "NEMManagerImpl::configure %s: %s",
185 bOTAManagerChannelLoopback_ ?
"on" :
"off");
187 else if(item.first ==
"otamanagerchannelenable")
189 bOTAManagerChannelEnable_ = item.second[0].asBool();
193 "NEMManagerImpl::configure %s: %s",
195 bOTAManagerChannelEnable_ ?
"on" :
"off");
197 else if(item.first ==
"eventservicegroup")
199 eventServiceGroupAddr_ = item.second[0].asINETAddr();
203 "NEMManagerImpl::configure %s: %s",
205 eventServiceGroupAddr_.
str().c_str());
208 else if(item.first ==
"eventservicedevice")
210 sEventServiceDevice_ = item.second[0].asString();
214 "NEMManagerImpl::configure %s: %s",
216 sEventServiceDevice_.c_str());
219 else if(item.first ==
"eventservicettl")
221 u8EventServiceTTL_ = item.second[0].asUINT8();
225 "NEMManagerImpl::configure %s: %hhu",
229 else if(item.first ==
"controlportendpoint")
231 controlPortAddr_ = item.second[0].asINETAddr();
235 "NEMManagerImpl::configure %s: %s",
237 controlPortAddr_.
str().c_str());
240 else if(item.first ==
"antennaprofilemanifesturi")
242 sAntennaProfileManifestURI_ = item.second[0].asString();
246 "NEMManagerImpl::configure %s: %s",
248 sAntennaProfileManifestURI_.c_str());
251 else if(item.first ==
"stats.ota.maxpacketcountrows")
253 std::uint32_t u32OTAMaxPacketCountRows = item.second[0].asUINT32();
257 "NEMManagerImpl::configure %s: %u",
259 u32OTAMaxPacketCountRows);
262 setStatPacketCountRowLimit(u32OTAMaxPacketCountRows);
264 else if(item.first ==
"stats.ota.maxeventcountrows")
266 std::uint32_t u32OTAMaxEventCountRows = item.second[0].asUINT32();
270 "NEMManagerImpl::configure %s: %u",
272 u32OTAMaxEventCountRows);
275 setStatEventCountRowLimit(u32OTAMaxEventCountRows);
277 else if(item.first ==
"stats.event.maxeventcountrows")
279 std::uint32_t u32EventMaxEventCountRows = item.second[0].asUINT32();
283 "NEMManagerImpl::configure %s: %u",
285 u32EventMaxEventCountRows);
288 setStatEventCountRowLimit(u32EventMaxEventCountRows);
292 throw makeException<ConfigureException>(
"NEMManagerImpl: " 293 "Unexpected configuration item %s",
299 if(!sAntennaProfileManifestURI_.empty())
308 if(bOTAManagerChannelEnable_)
313 sOTAManagerGroupDevice_,
314 bOTAManagerChannelLoopback_,
327 sEventServiceDevice_,
337 controlPortService_.
open(controlPortAddr_);
339 std::for_each(platformNEMMap_.begin(),
340 platformNEMMap_.end(),
342 std::bind(&PlatformNEMMap::value_type::second,
343 std::placeholders::_1)));
348 std::for_each(platformNEMMap_.begin(),
349 platformNEMMap_.end(),
351 std::bind(&PlatformNEMMap::value_type::second,
352 std::placeholders::_1)));
357 controlPortService_.
close();
359 std::for_each(platformNEMMap_.begin(),
360 platformNEMMap_.end(),
362 std::bind(&PlatformNEMMap::value_type::second,
363 std::placeholders::_1)));
369 std::for_each(platformNEMMap_.begin(),
370 platformNEMMap_.end(),
372 std::bind(&PlatformNEMMap::value_type::second,
373 std::placeholders::_1)));
void load(const std::string &sAntennaProfileURI)
The Registrar interface provides access to all of the emulator registrars.
virtual ConfigurationRegistrar & configurationRegistrar()=0
void open(const INETAddr &endpoint)
void registerNonNumeric(const std::string &sName, const ConfigurationProperties &properties=ConfigurationProperties::NONE, const std::initializer_list< T > &values={}, const std::string &sUsage="", std::size_t minOccurs=1, std::size_t maxOccurs=1, const std::string &sRegexPattern={})
Exception thrown when registering or unregistering OTAUsers.
const char * what() const
Contains and manages NEM instances.
void open(const INETAddr &eventChannelAddress, const std::string &sDevice, int iTTL, bool loopbackEnable, const uuid_t &uuid)
std::string str(bool bWithPort=true) const
void add(std::unique_ptr< NEM > &pNEM) override
void configure(const ConfigurationUpdate &update) override
void postStart() override
void open(const INETAddr &otaGroupAddress, const std::string &sDevice, bool bLoopback, int iTTL, const uuid_t &uuid)
Component start exception is used to indicate an exception during transition to the start state...
NEMManagerImpl(const uuid_t &uuid)
std::vector< ConfigurationNameAnyValues > ConfigurationUpdate
void initialize(Registrar ®istrar) override
#define LOGGER_STANDARD_LOGGING(logger, level, fmt, args...)
static LogService * instance()
Exception thrown during open/establishment of the event service communication channel.