Skip to content

Commit

Permalink
implement connection route
Browse files Browse the repository at this point in the history
  • Loading branch information
Tyler-Lentz committed Apr 17, 2024
1 parent 8b86de0 commit 7c1f256
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 6 deletions.
6 changes: 3 additions & 3 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
// also: need to run obcpp with sudo or add tuas user to dialout group with
// `sudo usermod -aG dialout tuas && newgrp && bash`
// "runArgs": ["--device=/dev/ttyACM0"],
"runArgs": [
"--network=host"
],
// "runArgs": [
// "--network=host"
// ],

"customizations": {
"vscode": {
Expand Down
2 changes: 1 addition & 1 deletion protos
Submodule protos updated 1 files
+2 −2 obc.proto
4 changes: 4 additions & 0 deletions src/network/gcs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ GCSServer::~GCSServer() {
}

void GCSServer::_bindHandlers() {
this->server.Get("/", [](const httplib::Request& request, httplib::Response& response) {
response.status = 200;
response.set_content("Fort-nite", "text/plain");
});
BIND_HANDLER(Get, connections);
BIND_HANDLER(Get, tick);
BIND_HANDLER(Get, mission);
Expand Down
22 changes: 20 additions & 2 deletions src/network/gcs_routes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,26 @@ using namespace std::chrono_literals;
DEF_GCS_HANDLE(Get, connections) {
LOG_REQUEST("GET", "/connections");

auto lost_airdrop_conns = state->getAirdrop()->getLostConnections(3s);
auto mav_conn = state->getMav()->get_conn_status();
std::list<std::pair<BottleDropIndex, std::chrono::milliseconds>> lost_airdrop_conns;
if (state->getAirdrop() == nullptr) {
lost_airdrop_conns.push_back({BottleDropIndex::A, 99999ms});
lost_airdrop_conns.push_back({BottleDropIndex::B, 99999ms});
lost_airdrop_conns.push_back({BottleDropIndex::C, 99999ms});
lost_airdrop_conns.push_back({BottleDropIndex::D, 99999ms});
lost_airdrop_conns.push_back({BottleDropIndex::E, 99999ms});
} else {
lost_airdrop_conns = state->getAirdrop()->getLostConnections(3s);
}

mavsdk::Telemetry::RcStatus mav_conn;

if (state->getMav() == nullptr) {
mav_conn.is_available = false;
mav_conn.signal_strength_percent = 0.1;
} else {
mav_conn = state->getMav()->get_conn_status();
}

// TODO: query the camera status
bool camera_good = false;

Expand Down

0 comments on commit 7c1f256

Please sign in to comment.