| 201 | |
| 202 | |
| 203 | string WorkflowMachine::GetState() |
| 204 | { |
| 205 | rapidjson::Document request(rapidjson::kObjectType); |
| 206 | rapidjson::Document::AllocatorType& allocator = request.GetAllocator(); |
| 207 | request.AddMember("command", "status", allocator); |
| 208 | rapidjson::StringBuffer buffer; |
| 209 | rapidjson::Writer<rapidjson::StringBuffer> writer(buffer); |
| 210 | request.Accept(writer); |
| 211 | |
| 212 | string jsonResult; |
| 213 | if (m_function) |
| 214 | jsonResult = BNPostWorkflowRequestForFunction(m_function->GetObject(), buffer.GetString()); |
| 215 | else |
| 216 | jsonResult = BNPostWorkflowRequestForBinaryView(m_view->GetObject(), buffer.GetString()); |
| 217 | |
| 218 | rapidjson::Document response(rapidjson::kObjectType); |
| 219 | response.Parse(jsonResult.c_str()); |
| 220 | if (response.HasMember("machineState") && response["machineState"].HasMember("state")) |
| 221 | return response["machineState"]["state"].GetString(); |
| 222 | |
| 223 | return "Invalid"; |
| 224 | } |
| 225 | |
| 226 | |
| 227 | std::pair<bool, bool> WorkflowMachine::GetLogStatus() |