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

Add new websocket messages for managing station state #62

Merged
merged 61 commits into from
Jul 21, 2024

Conversation

neilenns
Copy link
Contributor

@neilenns neilenns commented May 18, 2024

Fixes #53

  • Adds three new incoming websocket messages: kSetStationState, kGetStationState, and kGetStationStates
  • Adds fournew outgoing websocket messages: kStationStateUpdate, kStationStates, and kVoiceConnectedState
  • Adds a new RadioHelper class with a method to manage setting radio states
  • Removes all direct radio state setting code from main.cpp and uses RadioHelper instead
  • Adds a new IPC message station-state-update
  • Updates an AFV radio with the values provided in kSetStationState messages
  • Updates the client to respond to station-state-update to refresh the state of a radio based on the values received

See comments on the PR for additional info.

backend/include/sdk.hpp Outdated Show resolved Hide resolved
backend/include/sdk.hpp Outdated Show resolved Hide resolved
backend/src/main.cpp Outdated Show resolved Hide resolved
@neilenns neilenns marked this pull request as ready for review July 15, 2024 21:58

return Napi::Boolean::New(info.Env(), true);
auto result = RadioHelper::SetRadioState(MainThreadShared::mApiServer.get(), newState);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd rather you you don't access the raw ptr behind the shared_ptr, if it's currently a unique_ptr change it to a shared_ptr and pass it by reference, that's the whole point of smart pointers

newState.headset = false;
newState.xca = false;

RadioHelper::SetRadioState(MainThreadShared::mApiServer.get(), newState);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here, no raw pointers please


return Napi::Boolean::New(info.Env(), true);
auto result = RadioHelper::SetRadioState(MainThreadShared::mApiServer.get(), newState);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here for raw pointers

backend/src/sdk.cpp Show resolved Hide resolved
backend/src/sdk.cpp Show resolved Hide resolved
backend/src/sdk.cpp Outdated Show resolved Hide resolved
src/renderer/src/components/bootstrap.tsx Outdated Show resolved Hide resolved
@neilenns neilenns requested a review from pierr3 July 21, 2024 16:16
@pierr3 pierr3 merged commit 181eae3 into pierr3:main Jul 21, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add HTTP endpoint for getting current status for a specific station
2 participants