|
@@ -114,7 +114,15 @@ CmdMan::CmdRet CmdMan::cmdStatus(vector<string> args) {
|
|
|
DEBUGPRINT(string(__PRETTY_FUNCTION__) + " begin");
|
|
|
Json::Value root;
|
|
|
root["command"] = "status";
|
|
|
- retval.type = send;
|
|
|
+ if (currentState == normal) {
|
|
|
+ retval.type = send;
|
|
|
+ } else if (currentState == connectionpossible || currentState == disconnecttoexit || currentState == disconnecttoexitearly) {
|
|
|
+ retval.type = print;
|
|
|
+ root["response"] = "You are not connected.";
|
|
|
+ } else {
|
|
|
+ retval.type = print;
|
|
|
+ root["response"] = "Connected to " + ip + ":" + std::to_string(port) + ". Not logged in.";
|
|
|
+ }
|
|
|
retval.msg = root;
|
|
|
|
|
|
return retval;
|
|
@@ -471,7 +479,7 @@ CmdMan::CmdRet CmdMan::execute(string cmd, vector<string> args) {
|
|
|
if (cmd.compare("version") && cmd.compare("connect")) {
|
|
|
retval.type = error;
|
|
|
root["command"] = "error";
|
|
|
- root["error"] = string("Not connected. Connect using \"connect ip [port]\".");
|
|
|
+ root["error"] = "Not connected. Please connect.";
|
|
|
retval.msg = root;
|
|
|
return retval;
|
|
|
}
|
|
@@ -798,7 +806,6 @@ CmdMan::CmdRet CmdMan::handlePutdata(Json::Value root) {
|
|
|
DEBUGPRINT(string(__PRETTY_FUNCTION__) + " begin");
|
|
|
output["command"] = "putdata";
|
|
|
output["file"] = fileman.getPutName();
|
|
|
- output["speed"] = 0.0f; // TODO
|
|
|
output["cancel"] = true;
|
|
|
|
|
|
if (root["cancel"].asBool()) {
|
|
@@ -827,8 +834,6 @@ CmdMan::CmdRet CmdMan::handlePutdata(Json::Value root) {
|
|
|
if (!root["received"].asInt()) {
|
|
|
// everything sent
|
|
|
retval.type = print;
|
|
|
- // TODO
|
|
|
- //~ retval.msg = "succesfully uploaded file " + fileman.getPutName();
|
|
|
fileman.closePut();
|
|
|
} else {
|
|
|
retval.type = print | send;
|
|
@@ -876,7 +881,6 @@ CmdMan::CmdRet CmdMan::handleGetdata(Json::Value root) {
|
|
|
DEBUGPRINT(string(__PRETTY_FUNCTION__) + " begin");
|
|
|
output["command"] = "getdata";
|
|
|
output["file"] = fileman.getGetName();
|
|
|
- output["speed"] = 0.0f; // TODO
|
|
|
output["cancel"] = true;
|
|
|
|
|
|
if (root["cancel"].asBool()) {
|
|
@@ -903,7 +907,6 @@ CmdMan::CmdRet CmdMan::handleGetdata(Json::Value root) {
|
|
|
if (!root["remaining"].asInt()) {
|
|
|
// everything received
|
|
|
retval.type = print;
|
|
|
- //~ retval.msg = "succesfully downloaded file " + fileman.getGetName();
|
|
|
fileman.closeGet();
|
|
|
} else {
|
|
|
retval.type = print | send;
|