Mercurial > hg > orthanc-stone
diff Deprecated/Platforms/Wasm/WasmPlatformApplicationAdapter.cpp @ 1400:419d0320c344
moved Platforms into Deprecated
author | Alain Mazy <alain@mazy.be> |
---|---|
date | Wed, 29 Apr 2020 20:45:14 +0200 |
parents | Platforms/Wasm/WasmPlatformApplicationAdapter.cpp@4fe4b221a31f |
children | 828a9b4ee1b7 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Deprecated/Platforms/Wasm/WasmPlatformApplicationAdapter.cpp Wed Apr 29 20:45:14 2020 +0200 @@ -0,0 +1,59 @@ +#include "WasmPlatformApplicationAdapter.h" + +#include "Framework/StoneException.h" +#include <stdio.h> +#include "Platforms/Wasm/Defaults.h" + +namespace OrthancStone +{ + WasmPlatformApplicationAdapter::WasmPlatformApplicationAdapter(MessageBroker& broker, IStoneApplication& application) + : IObserver(broker), + application_(application) + { + } + + void WasmPlatformApplicationAdapter::HandleSerializedMessageFromWeb(std::string& output, const std::string& input) + { + try + { + application_.HandleSerializedMessage(input.c_str()); + } + catch (StoneException& exc) + { + printf("Error while handling message from web (error code = %d):\n", exc.GetErrorCode()); + printf("While interpreting input: '%s'\n", input.c_str()); + output = std::string("ERROR : "); + } + catch (std::exception& exc) + { + printf("Error while handling message from web (error text = %s):\n", exc.what()); + printf("While interpreting input: '%s'\n", input.c_str()); + output = std::string("ERROR : "); + } + } + + void WasmPlatformApplicationAdapter::NotifyStatusUpdateFromCppToWebWithString(const std::string& statusUpdateMessage) + { + try + { + UpdateStoneApplicationStatusFromCppWithString(statusUpdateMessage.c_str()); + } + catch (...) + { + printf("Error while handling string message to web\n"); + } + } + + void WasmPlatformApplicationAdapter::NotifyStatusUpdateFromCppToWebWithSerializedMessage(const std::string& statusUpdateMessage) + { + try + { + UpdateStoneApplicationStatusFromCppWithSerializedMessage(statusUpdateMessage.c_str()); + } + catch (...) + { + printf("Error while handling serialized message to web\n"); + } + } + +}