comparison 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
comparison
equal deleted inserted replaced
1399:ff8d2e46ac63 1400:419d0320c344
1 #include "WasmPlatformApplicationAdapter.h"
2
3 #include "Framework/StoneException.h"
4 #include <stdio.h>
5 #include "Platforms/Wasm/Defaults.h"
6
7 namespace OrthancStone
8 {
9 WasmPlatformApplicationAdapter::WasmPlatformApplicationAdapter(MessageBroker& broker, IStoneApplication& application)
10 : IObserver(broker),
11 application_(application)
12 {
13 }
14
15 void WasmPlatformApplicationAdapter::HandleSerializedMessageFromWeb(std::string& output, const std::string& input)
16 {
17 try
18 {
19 application_.HandleSerializedMessage(input.c_str());
20 }
21 catch (StoneException& exc)
22 {
23 printf("Error while handling message from web (error code = %d):\n", exc.GetErrorCode());
24 printf("While interpreting input: '%s'\n", input.c_str());
25 output = std::string("ERROR : ");
26 }
27 catch (std::exception& exc)
28 {
29 printf("Error while handling message from web (error text = %s):\n", exc.what());
30 printf("While interpreting input: '%s'\n", input.c_str());
31 output = std::string("ERROR : ");
32 }
33 }
34
35 void WasmPlatformApplicationAdapter::NotifyStatusUpdateFromCppToWebWithString(const std::string& statusUpdateMessage)
36 {
37 try
38 {
39 UpdateStoneApplicationStatusFromCppWithString(statusUpdateMessage.c_str());
40 }
41 catch (...)
42 {
43 printf("Error while handling string message to web\n");
44 }
45 }
46
47 void WasmPlatformApplicationAdapter::NotifyStatusUpdateFromCppToWebWithSerializedMessage(const std::string& statusUpdateMessage)
48 {
49 try
50 {
51 UpdateStoneApplicationStatusFromCppWithSerializedMessage(statusUpdateMessage.c_str());
52 }
53 catch (...)
54 {
55 printf("Error while handling serialized message to web\n");
56 }
57 }
58
59 }