diff options
author | Andrey Shamanin <andrei.shamanin@orioninc.com> | 2020-10-16 16:08:27 +0300 |
---|---|---|
committer | Andrey Shamanin <andrei.shamanin@orioninc.com> | 2020-10-19 15:41:37 +0300 |
commit | 2d66933b9bf25af66696b097283109c8a6e87151 (patch) | |
tree | 92a0bc61822540d5175a87d643fcca24d4acb216 /sample/README.md | |
parent | aee2ff16cc87a939e68aa2900e23d6705dda5408 (diff) |
Add AWS support to libcloudproxyneedlefish_13.93.0needlefish/13.93.0marlin_12.93.0marlin_12.92.0marlin_12.91.0marlin_12.90.1marlin_12.90.0marlin/12.93.0marlin/12.92.0marlin/12.91.0marlin/12.90.1marlin/12.90.0lamprey_11.92.0lamprey_11.91.0lamprey/11.92.0lamprey/11.91.0koi_10.93.0koi_10.92.0koi_10.91.0koi/10.93.0koi/10.92.0koi/10.91.013.93.012.93.012.92.012.91.012.90.112.90.011.92.011.91.010.93.010.92.010.91.0
Bug-AGL: SPEC-3645
Signed-off-by: Andrey Shamanin <andrei.shamanin@orioninc.com>
Change-Id: Ie165a50e7975a8e6f25b259be1679a9689414148
Diffstat (limited to 'sample/README.md')
-rwxr-xr-x | sample/README.md | 66 |
1 files changed, 42 insertions, 24 deletions
diff --git a/sample/README.md b/sample/README.md index 8edaddd..dd05521 100755 --- a/sample/README.md +++ b/sample/README.md @@ -36,7 +36,7 @@ CloudProxy client hides the communication with CloudProxy server. It incupsulate * Include the appropriate header to appliciation
```
- #include "cloudproxy-client/cloudproxyclient.h"
+ #include "libcloudproxy.h"
```
* Initialization of the CloudProxy client inside the application:
@@ -57,36 +57,53 @@ g_cloudproxyclient->init(port, token.c_str()); ```
-g_cloudproxyclient->set_event_handler(CloudProxyClient::Event_SendMessageConfirmation, [](json_object* object){
- json_object *j_result;
- if(!json_object_object_get_ex(object, "result", &j_result))
- {
- qDebug("Can't read confirmation result");
- return;
- }
-
- qDebug("Confirmation result %d", (int)json_object_get_boolean(j_result));
- });
+ g_cloudproxyclient->set_event_handler(CloudProxyClient::Event_SendMessageConfirmation, [](json_object* object){
+ json_object *j_obj;
+ const char* cloud_type{nullptr};
+ if(!json_object_object_get_ex(object, "cloud_type", &j_obj) ||
+ (cloud_type = json_object_get_string(j_obj)) == nullptr)
+ {
+ qDebug("Can't read cloud_type");
+ return;
+ }
+
+ if(!json_object_object_get_ex(object, "result", &j_obj))
+ {
+ qDebug("Can't read confirmation result");
+ return;
+ }
+
+ qDebug("Confirmation result from %s: %d", cloud_type, (int)json_object_get_boolean(j_obj));
+ });
```
-* Subsription to the Event_SendMessageConfirmation
+* Subsription to the Event_ReceivedMessage
```
g_cloudproxyclient->set_event_handler(CloudProxyClient::Event_ReceivedMessage, [](json_object* object)
- json_object *event_data;
- const char* data_str{nullptr};
- if(!json_object_object_get_ex(object, "data", &event_data) ||
- data_str = json_object_get_string(event_data)) == nullptr)
- {
- qDebug("Can't read event data");
- return;
- }
-
- qDebug("Received data: %s", data_str);
- });
+ json_object *j_obj;
+ const char* cloud_type{nullptr};
+ if(!json_object_object_get_ex(object, "cloud_type", &j_obj) ||
+ (cloud_type = json_object_get_string(j_obj)) == nullptr)
+ {
+ qDebug("Can't read cloud_type");
+ return;
+ }
+
+ json_object *event_data;
+ const char* data_str{nullptr};
+ if(!json_object_object_get_ex(object, "data", &event_data) ||
+ (data_str = json_object_get_string(event_data)) == nullptr)
+ {
+ qDebug("Can't read event data");
+ return;
+ }
+
+ qDebug("Received data from %s: %s", cloud_type, data_str);
+ });
```
@@ -94,5 +111,6 @@ g_cloudproxyclient->set_event_handler(CloudProxyClient::Event_ReceivedMessage, [ ```
-qDebug() << "sendMessage result: " << g_cloudproxyclient->sendMessage("{\"app_key\": \"app_value1111\"}");
+qDebug() << "sendMessage to Azure: result: " << g_cloudproxyclient->sendMessage(CloudType::Azure, "{\"app_key\": \"app_value1111\"}");
+qDebug() << "sendMessage to AWS: result: " << g_cloudproxyclient->sendMessage(CloudType::Aws, "{\"app_key\": \"app_value1111\"}");
```
\ No newline at end of file |