Skip to content

Commit

Permalink
[occ] Set run number on every transition
Browse files Browse the repository at this point in the history
  • Loading branch information
teo committed May 14, 2019
1 parent 956cc15 commit c44fe24
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions occ/occlib/OccServer.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,15 @@

#include "OccServer.h"

#include <cstdlib>
#include "util/Defer.h"
#include <boost/uuid/uuid_generators.hpp>
#include <boost/uuid/uuid_io.hpp>
#include <boost/algorithm/string.hpp>
#include <boost/property_tree/ptree.hpp>

#include "RuntimeControlledObject.h"
#include "RuntimeControlledObjectPrivate.h"

using namespace std::chrono_literals;

Expand Down Expand Up @@ -220,13 +222,18 @@ t_State OccServer::processStateTransition(const std::string& event, const boost:
t_State currentState = m_rco->getState();
t_State newState = currentState;

std::string rns = properties.get<std::string>("runNumber", "0");
RunNumber newRunNumber = std::strtoul(rns.c_str(), nullptr, 10);

std::string evt = boost::algorithm::to_lower_copy(event);

printf("Object: %s - processing event %s in state %s\n",
printf("Object: %s - processing event %s in state %s with run number %lu.\n",
m_rco->getName().c_str(),
evt.c_str(),
getStringFromState(currentState).c_str());
getStringFromState(currentState).c_str(),
newRunNumber);

m_rco->dPtr->mCurrentRunNumber = newRunNumber;
// STANDBY
if (currentState==t_State::standby) {
if (evt=="configure") {
Expand Down

0 comments on commit c44fe24

Please sign in to comment.