Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Breaking change: rename WSClient to SKWSClient #690

Merged
merged 1 commit into from
Apr 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions examples/freertos_tasks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#include "sensesp/net/discovery.h"
#include "sensesp/net/http_server.h"
#include "sensesp/net/networking.h"
#include "sensesp/net/ws_client.h"
#include "sensesp/signalk/signalk_ws_client.h"
#include "sensesp/sensors/digital_input.h"
#include "sensesp/signalk/signalk_delta_queue.h"
#include "sensesp/signalk/signalk_output.h"
Expand Down Expand Up @@ -50,10 +50,10 @@ void setup() {
auto sk_delta_queue_ = new SKDeltaQueue();

// create the websocket client
auto ws_client_ = new WSClient("/system/sk", sk_delta_queue_, "", 0);
auto ws_client_ = new SKWSClient("/system/sk", sk_delta_queue_, "", 0);

ws_client_->connect_to(new LambdaConsumer<WSConnectionState>(
[](WSConnectionState input) { debugD("WSConnectionState: %d", input); }));
ws_client_->connect_to(new LambdaConsumer<SKWSConnectionState>(
[](SKWSConnectionState input) { debugD("SKWSConnectionState: %d", input); }));

// create the MDNS discovery object
auto mdns_discovery_ = new MDNSDiscovery();
Expand Down
20 changes: 10 additions & 10 deletions src/sensesp/controllers/system_status_controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,33 +15,33 @@ void SystemStatusController::set(WiFiState new_value,
break;
case WiFiState::kWifiConnectedToAP:
case WiFiState::kWifiAPModeActivated:
this->update_state(SystemStatus::kWSDisconnected);
this->update_state(SystemStatus::kSKWSDisconnected);
break;
case WiFiState::kWifiManagerActivated:
this->update_state(SystemStatus::kWifiManagerActivated);
break;
}
}

void SystemStatusController::set(WSConnectionState new_value,
void SystemStatusController::set(SKWSConnectionState new_value,
uint8_t input_channel) {
switch (new_value) {
case WSConnectionState::kWSDisconnected:
case SKWSConnectionState::kSKWSDisconnected:
if (current_state_ != SystemStatus::kWifiDisconnected &&
current_state_ != SystemStatus::kWifiNoAP &&
current_state_ != SystemStatus::kWifiManagerActivated) {
// Wifi disconnection states override the higher level protocol state
this->update_state(SystemStatus::kWSDisconnected);
this->update_state(SystemStatus::kSKWSDisconnected);
}
break;
case WSConnectionState::kWSConnecting:
this->update_state(SystemStatus::kWSConnecting);
case SKWSConnectionState::kSKWSConnecting:
this->update_state(SystemStatus::kSKWSConnecting);
break;
case WSConnectionState::kWSAuthorizing:
this->update_state(SystemStatus::kWSAuthorizing);
case SKWSConnectionState::kSKWSAuthorizing:
this->update_state(SystemStatus::kSKWSAuthorizing);
break;
case WSConnectionState::kWSConnected:
this->update_state(SystemStatus::kWSConnected);
case SKWSConnectionState::kSKWSConnected:
this->update_state(SystemStatus::kSKWSConnected);
break;
}
}
Expand Down
18 changes: 9 additions & 9 deletions src/sensesp/controllers/system_status_controller.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#define _SYSTEM_STATUS_CONTROLLER_H_

#include "sensesp/net/networking.h"
#include "sensesp/net/ws_client.h"
#include "sensesp/signalk/signalk_ws_client.h"
#include "sensesp/system/valueproducer.h"

namespace sensesp {
Expand All @@ -11,10 +11,10 @@ enum class SystemStatus {
kWifiNoAP = 100,
kWifiDisconnected,
kWifiManagerActivated,
kWSDisconnected,
kWSAuthorizing,
kWSConnecting,
kWSConnected
kSKWSDisconnected,
kSKWSAuthorizing,
kSKWSConnecting,
kSKWSConnected
};

/**
Expand All @@ -25,7 +25,7 @@ enum class SystemStatus {
* an event occurs.
*/
class SystemStatusController : public ValueConsumer<WiFiState>,
public ValueConsumer<WSConnectionState>,
public ValueConsumer<SKWSConnectionState>,
public ValueProducer<SystemStatus> {
public:
SystemStatusController() {}
Expand All @@ -34,9 +34,9 @@ class SystemStatusController : public ValueConsumer<WiFiState>,
/// state updates)
virtual void set(WiFiState new_value,
uint8_t input_channel = 0) override;
/// ValueConsumer interface for ValueConsumer<WSConnectionState>
/// (WSClient object state updates)
virtual void set(WSConnectionState new_value,
/// ValueConsumer interface for ValueConsumer<SKWSConnectionState>
/// (SKWSClient object state updates)
virtual void set(SKWSConnectionState new_value,
uint8_t input_channel = 0) override;

protected:
Expand Down
2 changes: 1 addition & 1 deletion src/sensesp/signalk/signalk_delta_queue.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace sensesp {
* @brief Signal K delta queue
*
* This class implements a Signal K delta queue. There should be a unique queue
* for each possible output channel (WSClient, NMEA 2000 messages,
* for each possible output channel (SKWSClient, NMEA 2000 messages,
* carrier pigeons).
*/
class SKDeltaQueue {
Expand Down
Loading
Loading