| 249 | |
| 250 | |
| 251 | bool WorkflowMachine::SetLogEnabled(bool enable, bool global) |
| 252 | { |
| 253 | rapidjson::Document request(rapidjson::kObjectType); |
| 254 | rapidjson::Document::AllocatorType& allocator = request.GetAllocator(); |
| 255 | request.AddMember("command", "log", allocator); |
| 256 | request.AddMember("enable", enable, allocator); |
| 257 | request.AddMember("global", global, allocator); |
| 258 | rapidjson::StringBuffer buffer; |
| 259 | rapidjson::Writer<rapidjson::StringBuffer> writer(buffer); |
| 260 | request.Accept(writer); |
| 261 | |
| 262 | string jsonResult; |
| 263 | if (m_function) |
| 264 | jsonResult = BNPostWorkflowRequestForFunction(m_function->GetObject(), buffer.GetString()); |
| 265 | else |
| 266 | jsonResult = BNPostWorkflowRequestForBinaryView(m_view->GetObject(), buffer.GetString()); |
| 267 | |
| 268 | rapidjson::Document response(rapidjson::kObjectType); |
| 269 | response.Parse(jsonResult.c_str()); |
| 270 | if (response.HasMember("commandStatus") && response["commandStatus"].HasMember("accepted")) |
| 271 | return response["commandStatus"]["accepted"].GetBool(); |
| 272 | |
| 273 | return false; |
| 274 | } |
| 275 | |
| 276 | |
| 277 | std::optional<bool> WorkflowMachine::QueryOverride(const string& activity) |