Commit cfa79e99 authored by beuchatp's avatar beuchatp
Browse files

Changed Get Agent Status service to return strings

parent 188acc2f
// Copyright (C) 2019, ETH Zurich, D-ITET, Paul Beuchat
// Copyright (C) 2020, The University of Melbourne, Department of Electrical and Electronic Engineering (EEE), Paul Beuchat
//
// This file is part of D-FaLL-System.
//
......
// Copyright (C) 2019, ETH Zurich, D-ITET, Paul Beuchat
// Copyright (C) 2020, The University of Melbourne, Department of Electrical and Electronic Engineering (EEE), Paul Beuchat
//
// This file is part of D-FaLL-System.
//
......@@ -114,9 +114,36 @@ void studentControllerSetpointChangedCallback(const SetpointWithHeader& newSetpo
// SERVICE CALLBACK FOR PROVIDING STATUS TO THE WEB INTERFACE
bool statusForWebInterfaceCallback(IntStringService::Request &request, IntStringService::Response &response)
{
// Get the statuses as string
str::string crazyradio_status_string;
switch (m_crazyradio_status)
{
case CRAZY_RADIO_STATE_CONNECTED:
{
crazyradio_status_string = "connected";
break;
}
case CRAZY_RADIO_STATE_CONNECTING:
{
crazyradio_status_string = "connecting";
break;
}
case CRAZY_RADIO_STATE_DISCONNECTED:
{
crazyradio_status_string = "disconnected";
break;
}
default:
{
crazyradio_status_string = "unknown";
break;
}
}
// Concatenate the json together using a string stream
std::stringstream ss;
ss << "{\"crazyradiostatus\": \"" << m_crazyradio_status << "\"}";
ss << "{\u0022crazyradiostatus\u0022: \u0022" << crazyradio_status_string << "\u0022}";
//ss << R"({"crazyradiostatus": ")" << m_crazyradio_status << R"("})";
std::string s = ss.str();
// Put the string into the response
//response.data = "test of service for web interface";
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment