|
@@ -6,6 +6,7 @@ JsonCommander::JsonCommander(FileManager &fileManager)
|
|
commandsMap["status"] = &JsonCommander::executeStatus;
|
|
commandsMap["status"] = &JsonCommander::executeStatus;
|
|
commandsMap["close"] = &JsonCommander::executeClose;
|
|
commandsMap["close"] = &JsonCommander::executeClose;
|
|
commandsMap["list"] = &JsonCommander::executeList;
|
|
commandsMap["list"] = &JsonCommander::executeList;
|
|
|
|
+ commandsMap["listdata"] = &JsonCommander::executeListData;
|
|
commandsMap["put"] = &JsonCommander::executePut;
|
|
commandsMap["put"] = &JsonCommander::executePut;
|
|
commandsMap["putdata"] = &JsonCommander::executePutdata;
|
|
commandsMap["putdata"] = &JsonCommander::executePutdata;
|
|
commandsMap["get"] = &JsonCommander::executeGet;
|
|
commandsMap["get"] = &JsonCommander::executeGet;
|
|
@@ -70,7 +71,6 @@ JsonCommander::Response JsonCommander::executeList(const Json::Value &message) {
|
|
response.json["accept"] = true;
|
|
response.json["accept"] = true;
|
|
|
|
|
|
int chunks = 0;
|
|
int chunks = 0;
|
|
- int counter = 0;
|
|
|
|
|
|
|
|
std::vector<std::string> v = fileManager.listFiles();
|
|
std::vector<std::string> v = fileManager.listFiles();
|
|
for(int i=0; i<v.size(); i++) {
|
|
for(int i=0; i<v.size(); i++) {
|
|
@@ -84,6 +84,25 @@ JsonCommander::Response JsonCommander::executeList(const Json::Value &message) {
|
|
return response;
|
|
return response;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+JsonCommander::Response JsonCommander::executeListData(const Json::Value &message) {
|
|
|
|
+ JsonCommander::Response response;
|
|
|
|
+ response.action = send;
|
|
|
|
+ response.json["command"] = "listdata";
|
|
|
|
+ Json::Value array;
|
|
|
|
+
|
|
|
|
+ std::vector<std::string> v = fileManager.listFiles();
|
|
|
|
+ for(int i=0; i<v.size(); i++) {
|
|
|
|
+ array.append(v.at(i));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ response.json["remaining"] = (int) v.size();
|
|
|
|
+ response.json["cancel"] = false;
|
|
|
|
+ response.json["names"] = array;
|
|
|
|
+ response.json["error"] = "";
|
|
|
|
+
|
|
|
|
+ return response;
|
|
|
|
+}
|
|
|
|
+
|
|
JsonCommander::Response JsonCommander::executePut(const Json::Value &message) {
|
|
JsonCommander::Response JsonCommander::executePut(const Json::Value &message) {
|
|
JsonCommander::Response response;
|
|
JsonCommander::Response response;
|
|
response.json["command"] = "put";
|
|
response.json["command"] = "put";
|