Rename SonarInitConfig
Summary: Part of sonar -> flipper rename Reviewed By: priteshrnandgaonkar Differential Revision: D9908472 fbshipit-source-id: f2e694b5abfa22a745ee4719d24d6aad8af6ee2a
This commit is contained in:
committed by
Facebook Github Bot
parent
9889df3f3c
commit
574c05c41d
@@ -3,7 +3,7 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <folly/io/async/SSLContext.h>
|
#include <folly/io/async/SSLContext.h>
|
||||||
#include <folly/dynamic.h>
|
#include <folly/dynamic.h>
|
||||||
#include "SonarInitConfig.h"
|
#include "FlipperInitConfig.h"
|
||||||
|
|
||||||
using namespace folly;
|
using namespace folly;
|
||||||
|
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ static FlipperClient* kInstance;
|
|||||||
|
|
||||||
using folly::dynamic;
|
using folly::dynamic;
|
||||||
|
|
||||||
void FlipperClient::init(SonarInitConfig config) {
|
void FlipperClient::init(FlipperInitConfig config) {
|
||||||
auto state = std::make_shared<SonarState>();
|
auto state = std::make_shared<SonarState>();
|
||||||
auto context = std::make_shared<ConnectionContextStore>(config.deviceData);
|
auto context = std::make_shared<ConnectionContextStore>(config.deviceData);
|
||||||
kInstance =
|
kInstance =
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "FlipperConnectionImpl.h"
|
#include "FlipperConnectionImpl.h"
|
||||||
#include "SonarInitConfig.h"
|
#include "FlipperInitConfig.h"
|
||||||
#include "SonarPlugin.h"
|
#include "SonarPlugin.h"
|
||||||
#include "SonarState.h"
|
#include "SonarState.h"
|
||||||
#include "SonarWebSocket.h"
|
#include "SonarWebSocket.h"
|
||||||
@@ -27,7 +27,7 @@ class FlipperClient : public SonarWebSocket::Callbacks {
|
|||||||
Call before accessing instance with FlipperClient::instance(). This will set up
|
Call before accessing instance with FlipperClient::instance(). This will set up
|
||||||
all the state needed to establish a Sonar connection.
|
all the state needed to establish a Sonar connection.
|
||||||
*/
|
*/
|
||||||
static void init(SonarInitConfig config);
|
static void init(FlipperInitConfig config);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Standard accessor for the shared FlipperClient instance. This returns a
|
Standard accessor for the shared FlipperClient instance. This returns a
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ struct DeviceData {
|
|||||||
std::string privateAppDirectory;
|
std::string privateAppDirectory;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct SonarInitConfig {
|
struct FlipperInitConfig {
|
||||||
/**
|
/**
|
||||||
Map of client specific configuration data such as app name, device name, etc.
|
Map of client specific configuration data such as app name, device name, etc.
|
||||||
*/
|
*/
|
||||||
@@ -77,7 +77,7 @@ class Responder : public rsocket::RSocketResponder {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
SonarWebSocketImpl::SonarWebSocketImpl(SonarInitConfig config, std::shared_ptr<SonarState> state, std::shared_ptr<ConnectionContextStore> contextStore)
|
SonarWebSocketImpl::SonarWebSocketImpl(FlipperInitConfig config, std::shared_ptr<SonarState> state, std::shared_ptr<ConnectionContextStore> contextStore)
|
||||||
: deviceData_(config.deviceData), sonarState_(state), sonarEventBase_(config.callbackWorker), connectionEventBase_(config.connectionWorker), contextStore_(contextStore) {
|
: deviceData_(config.deviceData), sonarState_(state), sonarEventBase_(config.callbackWorker), connectionEventBase_(config.connectionWorker), contextStore_(contextStore) {
|
||||||
CHECK_THROW(config.callbackWorker, std::invalid_argument);
|
CHECK_THROW(config.callbackWorker, std::invalid_argument);
|
||||||
CHECK_THROW(config.connectionWorker, std::invalid_argument);
|
CHECK_THROW(config.connectionWorker, std::invalid_argument);
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "SonarInitConfig.h"
|
#include "FlipperInitConfig.h"
|
||||||
#include "SonarWebSocket.h"
|
#include "SonarWebSocket.h"
|
||||||
#include "SonarState.h"
|
#include "SonarState.h"
|
||||||
#include <folly/Executor.h>
|
#include <folly/Executor.h>
|
||||||
@@ -28,7 +28,7 @@ class SonarWebSocketImpl : public SonarWebSocket {
|
|||||||
friend Responder;
|
friend Responder;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
SonarWebSocketImpl(SonarInitConfig config, std::shared_ptr<SonarState> state, std::shared_ptr<ConnectionContextStore> contextStore);
|
SonarWebSocketImpl(FlipperInitConfig config, std::shared_ptr<SonarState> state, std::shared_ptr<ConnectionContextStore> contextStore);
|
||||||
|
|
||||||
~SonarWebSocketImpl();
|
~SonarWebSocketImpl();
|
||||||
|
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ protected:
|
|||||||
|
|
||||||
TEST_F(SonarWebSocketImplTerminationTest, testNullEventBaseGetsRejected) {
|
TEST_F(SonarWebSocketImplTerminationTest, testNullEventBaseGetsRejected) {
|
||||||
try {
|
try {
|
||||||
auto instance = std::make_shared<SonarWebSocketImpl>(SonarInitConfig {
|
auto instance = std::make_shared<SonarWebSocketImpl>(FlipperInitConfig {
|
||||||
DeviceData {},
|
DeviceData {},
|
||||||
nullptr,
|
nullptr,
|
||||||
new EventBase()
|
new EventBase()
|
||||||
@@ -45,7 +45,7 @@ TEST_F(SonarWebSocketImplTerminationTest, testNullEventBaseGetsRejected) {
|
|||||||
// Pass test
|
// Pass test
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
auto instance = std::make_shared<SonarWebSocketImpl>(SonarInitConfig {
|
auto instance = std::make_shared<SonarWebSocketImpl>(FlipperInitConfig {
|
||||||
DeviceData {},
|
DeviceData {},
|
||||||
new EventBase(),
|
new EventBase(),
|
||||||
nullptr
|
nullptr
|
||||||
@@ -60,7 +60,7 @@ TEST_F(SonarWebSocketImplTerminationTest, testNullEventBaseGetsRejected) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(SonarWebSocketImplTerminationTest, testNonStartedEventBaseDoesntHang) {
|
TEST_F(SonarWebSocketImplTerminationTest, testNonStartedEventBaseDoesntHang) {
|
||||||
auto config = SonarInitConfig {
|
auto config = FlipperInitConfig {
|
||||||
DeviceData {},
|
DeviceData {},
|
||||||
new EventBase(),
|
new EventBase(),
|
||||||
new EventBase()
|
new EventBase()
|
||||||
@@ -78,7 +78,7 @@ TEST_F(SonarWebSocketImplTerminationTest, testStartedEventBaseDoesntHang) {
|
|||||||
auto connectionThread = std::thread([connectionEventBase](){
|
auto connectionThread = std::thread([connectionEventBase](){
|
||||||
connectionEventBase->loopForever();
|
connectionEventBase->loopForever();
|
||||||
});
|
});
|
||||||
auto config = SonarInitConfig {
|
auto config = FlipperInitConfig {
|
||||||
DeviceData {},
|
DeviceData {},
|
||||||
sonarEventBase,
|
sonarEventBase,
|
||||||
connectionEventBase
|
connectionEventBase
|
||||||
|
|||||||
Reference in New Issue
Block a user