Summary: These will be displayed in the sonar diagnostics screen, for troubleshooting connection issues. Reviewed By: danielbuechele Differential Revision: D9150552 fbshipit-source-id: c6d65fba86e7564fbb004aaa7b0303a1d5952e5d
39 lines
988 B
C++
39 lines
988 B
C++
/*
|
|
* Copyright (c) 2018-present, Facebook, Inc.
|
|
*
|
|
* This source code is licensed under the MIT license found in the LICENSE
|
|
* file in the root directory of this source tree.
|
|
*
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <memory>
|
|
#include <string>
|
|
#include <Sonar/SonarStep.h>
|
|
|
|
class SonarStep;
|
|
class SonarStateUpdateListener;
|
|
|
|
class SonarState {
|
|
friend SonarStep;
|
|
|
|
public:
|
|
SonarState();
|
|
void setUpdateListener(std::shared_ptr<SonarStateUpdateListener>);
|
|
std::string getState();
|
|
|
|
/* To record a state update, call start() with the name of the step to get a
|
|
SonarStep object. Call complete on this to register it successful,
|
|
the absense of the completion call when it is destructed will register as a
|
|
step failure. */
|
|
std::shared_ptr<SonarStep> start(std::string step);
|
|
|
|
private:
|
|
void success(std::string);
|
|
void failed(std::string, std::string);
|
|
void started(std::string);
|
|
std::shared_ptr<SonarStateUpdateListener> mListener = nullptr;
|
|
std::string stateUpdates;
|
|
};
|