Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: DmTftLibrary eeprom SX1280Lib filesystem mbed
Fork of MSNV2-Terminal_V1-5 by
Payload.cpp
- Committer:
- patrick_duc
- Date:
- 2018-09-02
- Revision:
- 20:b0281e8a375a
- Parent:
- 19:4b147d8f9164
- Child:
- 39:13e66d087ae9
File content as of revision 20:b0281e8a375a:
#include "Payload.hpp"
using namespace misnet;
Payload::Payload(Payload::PAYLOAD_ID id, std::vector<Component*> components, uint16_t base_period)
: _id(id), _components(components), _basePeriod(base_period) {
for (std::vector<Component*>::iterator it = this->_components.begin(); it != this->_components.end(); it++) {
Component* component = *it;
for(std::vector<Service*>::iterator it = component->getServices().begin(); it != component->getServices().end(); it++) {
this->_services.push_back(*it);
}
}
}
Service* Payload::getServiceByRank(short servicesRank) {
if (servicesRank < 1 || servicesRank > 6) {
return (Service*) NULL;
}
return this->_services[servicesRank - 1];
}
std::string Payload::toString() {
std::ostringstream stringStream;
stringStream << "Payload id : " << this->_id << std::endl;
stringStream << "It contains " << this->_components.size() << " components" << std::endl;
stringStream << "List of components :\n------------------" << std::endl;
std::vector<Component*>::iterator it;
for (it = this->_components.begin(); it != this->_components.end(); it++) {
stringStream << (*it)->toString() << std::endl;
}
std::vector<Service*> services = this->_services;
stringStream << "There are " << services.size() << " services." << std::endl;
stringStream << "List of services :\n------------------" << std::endl;
for(std::vector<Service*>::iterator it = services.begin(); it != services.end(); it++) {
Service* service = *it;
stringStream << service->toString() << std::endl;
}
return stringStream.str();
}
