Commit f4ae603d authored by Kishen Maloor's avatar Kishen Maloor

Merge branch 'origin/master' into fargo

Signed-off-by: Kishen Maloor's avatarKishen Maloor <kishen.maloor@intel.com>
parents 89a79af8 9f66512d
Pipeline #794 passed with stage
in 14 minutes and 44 seconds
...@@ -52,17 +52,13 @@ Android_build: ...@@ -52,17 +52,13 @@ Android_build:
- cd port/android - cd port/android
- make DYNAMIC=1 TCP=1 IPV4=1 SECURE=1 PKI=1 CLOUD=1 JAVA=1 DEBUG=0 - make DYNAMIC=1 TCP=1 IPV4=1 SECURE=1 PKI=1 CLOUD=1 JAVA=1 DEBUG=0
whitespace_and_doxygen: doxygen:
variables: variables:
GIT_SUBMODULE_STRATEGY: none GIT_SUBMODULE_STRATEGY: none
stage: build stage: build
before_script: before_script:
- apt update && apt -y install make autoconf doxygen clang-format - apt update && apt -y install doxygen
script: script:
- clang-format --version
- doxygen --version - doxygen --version
- cp tools/_clang-format _clang-format
- cp tools/whitespace_commit_checker.sh whitespace_commit_checker.sh
- ./whitespace_commit_checker.sh
- cd tools - cd tools
- ./build_doc.sh - ./build_doc.sh
...@@ -113,7 +113,7 @@ cloud_deregister_on_reset_internal(oc_cloud_context_t *ctx, ...@@ -113,7 +113,7 @@ cloud_deregister_on_reset_internal(oc_cloud_context_t *ctx,
cloud_store_initialize(&ctx->store); cloud_store_initialize(&ctx->store);
cloud_manager_stop(ctx); cloud_manager_stop(ctx);
ctx->last_error = 0; ctx->last_error = 0;
ctx->cps = 0; ctx->store.cps = 0;
} }
#endif /* OC_SECURITY */ #endif /* OC_SECURITY */
...@@ -137,7 +137,7 @@ oc_cloud_reset_context(size_t device) ...@@ -137,7 +137,7 @@ oc_cloud_reset_context(size_t device)
cloud_store_initialize(&ctx->store); cloud_store_initialize(&ctx->store);
cloud_manager_stop(ctx); cloud_manager_stop(ctx);
ctx->last_error = 0; ctx->last_error = 0;
ctx->cps = 0; ctx->store.cps = 0;
return 0; return 0;
} }
...@@ -168,7 +168,7 @@ oc_cloud_provision_conf_resource(oc_cloud_context_t *ctx, const char *server, ...@@ -168,7 +168,7 @@ oc_cloud_provision_conf_resource(oc_cloud_context_t *ctx, const char *server,
} }
ctx->store.status = OC_CLOUD_INITIALIZED; ctx->store.status = OC_CLOUD_INITIALIZED;
ctx->cps = OC_CPS_READYTOREGISTER; ctx->store.cps = OC_CPS_READYTOREGISTER;
cloud_store_dump_async(&ctx->store); cloud_store_dump_async(&ctx->store);
...@@ -204,7 +204,7 @@ cloud_update_by_resource(oc_cloud_context_t *ctx, ...@@ -204,7 +204,7 @@ cloud_update_by_resource(oc_cloud_context_t *ctx,
cloud_set_string(&ctx->store.sid, data->sid, data->sid_len); cloud_set_string(&ctx->store.sid, data->sid, data->sid_len);
} }
ctx->store.status = OC_CLOUD_INITIALIZED; ctx->store.status = OC_CLOUD_INITIALIZED;
ctx->cps = OC_CPS_READYTOREGISTER; ctx->store.cps = OC_CPS_READYTOREGISTER;
if (ctx->cloud_manager) { if (ctx->cloud_manager) {
cloud_reconnect(ctx); cloud_reconnect(ctx);
} }
......
...@@ -109,7 +109,7 @@ oc_cloud_register(oc_cloud_context_t *ctx, oc_cloud_cb_t cb, void *data) ...@@ -109,7 +109,7 @@ oc_cloud_register(oc_cloud_context_t *ctx, oc_cloud_cb_t cb, void *data)
oc_string(ctx->store.uid), oc_string(ctx->store.access_token), oc_string(ctx->store.uid), oc_string(ctx->store.access_token),
ctx->device, oc_cloud_register_handler, p)) { ctx->device, oc_cloud_register_handler, p)) {
cannotConnect = false; cannotConnect = false;
ctx->cps = OC_CPS_REGISTERING; ctx->store.cps = OC_CPS_REGISTERING;
} }
if (cannotConnect) { if (cannotConnect) {
cloud_set_last_error(ctx, CLOUD_ERROR_CONNECT); cloud_set_last_error(ctx, CLOUD_ERROR_CONNECT);
...@@ -231,17 +231,15 @@ cloud_deregistered_internal(oc_client_response_t *data) ...@@ -231,17 +231,15 @@ cloud_deregistered_internal(oc_client_response_t *data)
{ {
cloud_api_param_t *p = (cloud_api_param_t *)data->user_data; cloud_api_param_t *p = (cloud_api_param_t *)data->user_data;
oc_cloud_context_t *ctx = p->ctx; oc_cloud_context_t *ctx = p->ctx;
if (data->code >= OC_STATUS_SERVICE_UNAVAILABLE) { if (data->code < OC_STATUS_BAD_REQUEST ||
cloud_set_last_error(ctx, CLOUD_ERROR_CONNECT); data->code >= OC_STATUS_SERVICE_UNAVAILABLE) {
ctx->store.status |= OC_CLOUD_FAILURE; ctx->store.status = OC_CLOUD_DEREGISTERED;
} else if (data->code >= OC_STATUS_BAD_REQUEST) { } else if (data->code >= OC_STATUS_BAD_REQUEST) {
cloud_set_last_error(ctx, CLOUD_ERROR_RESPONSE); cloud_set_last_error(ctx, CLOUD_ERROR_RESPONSE);
ctx->store.status |= OC_CLOUD_FAILURE; ctx->store.status |= OC_CLOUD_FAILURE;
} else {
ctx->store.status = OC_CLOUD_DEREGISTERED;
} }
ctx->cps = OC_CPS_READYTOREGISTER; ctx->store.cps = OC_CPS_READYTOREGISTER;
if (p->cb) { if (p->cb) {
p->cb(ctx, ctx->store.status, p->data); p->cb(ctx, ctx->store.status, p->data);
...@@ -249,6 +247,8 @@ cloud_deregistered_internal(oc_client_response_t *data) ...@@ -249,6 +247,8 @@ cloud_deregistered_internal(oc_client_response_t *data)
free_api_param(p); free_api_param(p);
ctx->store.status &= ~(OC_CLOUD_FAILURE | OC_CLOUD_DEREGISTERED); ctx->store.status &= ~(OC_CLOUD_FAILURE | OC_CLOUD_DEREGISTERED);
cloud_store_dump_async(&ctx->store);
} }
int int
...@@ -362,7 +362,9 @@ cloud_access_register(oc_endpoint_t *endpoint, const char *auth_provider, ...@@ -362,7 +362,9 @@ cloud_access_register(oc_endpoint_t *endpoint, const char *auth_provider,
} }
#ifdef OC_SECURITY #ifdef OC_SECURITY
oc_tls_select_cloud_ciphersuite(); if (!oc_tls_connected(endpoint)) {
oc_tls_select_cloud_ciphersuite();
}
#endif /* OC_SECURITY */ #endif /* OC_SECURITY */
if (oc_init_post(OC_RSRVD_ACCOUNT_URI, endpoint, NULL, handler, LOW_QOS, if (oc_init_post(OC_RSRVD_ACCOUNT_URI, endpoint, NULL, handler, LOW_QOS,
...@@ -407,23 +409,32 @@ cloud_access_deregister(oc_endpoint_t *endpoint, const char *uid, ...@@ -407,23 +409,32 @@ cloud_access_deregister(oc_endpoint_t *endpoint, const char *uid,
OC_ERR("Error of input parameters"); OC_ERR("Error of input parameters");
return false; return false;
} }
oc_string_t d; oc_string_t at_uid;
(void)device;
oc_string_t at; oc_string_t at;
oc_concat_strings(&at, "accesstoken=", access_token); oc_concat_strings(&at, "accesstoken=", access_token);
oc_string_t u_id; oc_string_t u_id;
oc_concat_strings(&u_id, "&uid=", uid); oc_concat_strings(&u_id, "&uid=", uid);
oc_concat_strings(&d, oc_string(at), oc_string(u_id)); oc_concat_strings(&at_uid, oc_string(at), oc_string(u_id));
char uuid[OC_UUID_LEN] = { 0 };
oc_uuid_to_str(oc_core_get_device_id(device), uuid, OC_UUID_LEN);
oc_string_t di;
oc_concat_strings(&di, "&di=", uuid);
oc_string_t at_uid_di;
oc_concat_strings(&at_uid_di, oc_string(at_uid), oc_string(di));
#ifdef OC_SECURITY #ifdef OC_SECURITY
oc_tls_select_cloud_ciphersuite(); if (!oc_tls_connected(endpoint)) {
oc_tls_select_cloud_ciphersuite();
}
#endif /* OC_SECURITY */ #endif /* OC_SECURITY */
bool s = oc_do_delete(OC_RSRVD_ACCOUNT_URI, endpoint, oc_string(d), handler, bool s = oc_do_delete(OC_RSRVD_ACCOUNT_URI, endpoint, oc_string(at_uid_di),
HIGH_QOS, user_data); handler, HIGH_QOS, user_data);
oc_free_string(&d); oc_free_string(&at_uid);
oc_free_string(&at); oc_free_string(&at);
oc_free_string(&u_id); oc_free_string(&u_id);
oc_free_string(&di);
oc_free_string(&at_uid_di);
return s; return s;
} }
...@@ -445,7 +456,9 @@ cloud_access_login_out(oc_endpoint_t *endpoint, const char *uid, ...@@ -445,7 +456,9 @@ cloud_access_login_out(oc_endpoint_t *endpoint, const char *uid,
} }
#ifdef OC_SECURITY #ifdef OC_SECURITY
oc_tls_select_cloud_ciphersuite(); if (!oc_tls_connected(endpoint)) {
oc_tls_select_cloud_ciphersuite();
}
#endif /* OC_SECURITY */ #endif /* OC_SECURITY */
if (oc_init_post(OC_RSRVD_ACCOUNT_SESSION_URI, endpoint, NULL, handler, if (oc_init_post(OC_RSRVD_ACCOUNT_SESSION_URI, endpoint, NULL, handler,
...@@ -504,7 +517,9 @@ cloud_access_refresh_access_token(oc_endpoint_t *endpoint, const char *uid, ...@@ -504,7 +517,9 @@ cloud_access_refresh_access_token(oc_endpoint_t *endpoint, const char *uid,
} }
#ifdef OC_SECURITY #ifdef OC_SECURITY
oc_tls_select_cloud_ciphersuite(); if (!oc_tls_connected(endpoint)) {
oc_tls_select_cloud_ciphersuite();
}
#endif /* OC_SECURITY */ #endif /* OC_SECURITY */
if (oc_init_post(OC_RSRVD_ACCOUNT_TOKEN_REFRESH_URI, endpoint, NULL, handler, if (oc_init_post(OC_RSRVD_ACCOUNT_TOKEN_REFRESH_URI, endpoint, NULL, handler,
......
...@@ -146,8 +146,6 @@ _register_handler(oc_cloud_context_t *ctx, oc_client_response_t *data) ...@@ -146,8 +146,6 @@ _register_handler(oc_cloud_context_t *ctx, oc_client_response_t *data)
oc_rep_t *payload = data->payload; oc_rep_t *payload = data->payload;
ctx->store.status = 0;
char *value = NULL; char *value = NULL;
size_t size = 0; size_t size = 0;
...@@ -195,12 +193,14 @@ _register_handler(oc_cloud_context_t *ctx, oc_client_response_t *data) ...@@ -195,12 +193,14 @@ _register_handler(oc_cloud_context_t *ctx, oc_client_response_t *data)
cloud_set_last_error(ctx, CLOUD_OK); cloud_set_last_error(ctx, CLOUD_OK);
ctx->store.status |= OC_CLOUD_REGISTERED; ctx->store.status |= OC_CLOUD_REGISTERED;
ctx->cps = OC_CPS_REGISTERED; ctx->store.cps = OC_CPS_REGISTERED;
oc_notify_observers(ctx->cloud_conf);
return 0; return 0;
error: error:
ctx->cps = OC_CPS_FAILED; ctx->store.cps = OC_CPS_FAILED;
ctx->store.status |= OC_CLOUD_FAILURE; ctx->store.status |= OC_CLOUD_FAILURE;
if (ctx->last_error == 0) { if (ctx->last_error == 0) {
cloud_set_last_error(ctx, CLOUD_ERROR_RESPONSE); cloud_set_last_error(ctx, CLOUD_ERROR_RESPONSE);
...@@ -259,7 +259,7 @@ cloud_register(void *data) ...@@ -259,7 +259,7 @@ cloud_register(void *data)
oc_string(ctx->store.uid), oc_string(ctx->store.access_token), oc_string(ctx->store.uid), oc_string(ctx->store.access_token),
ctx->device, cloud_register_handler, data)) { ctx->device, cloud_register_handler, data)) {
cannotConnect = false; cannotConnect = false;
ctx->cps = OC_CPS_REGISTERING; ctx->store.cps = OC_CPS_REGISTERING;
} }
if (cannotConnect) { if (cannotConnect) {
cloud_set_last_error(ctx, CLOUD_ERROR_CONNECT); cloud_set_last_error(ctx, CLOUD_ERROR_CONNECT);
...@@ -297,7 +297,7 @@ _login_handler(oc_cloud_context_t *ctx, oc_client_response_t *data) ...@@ -297,7 +297,7 @@ _login_handler(oc_cloud_context_t *ctx, oc_client_response_t *data)
return 0; return 0;
error: error:
ctx->cps = OC_CPS_FAILED; ctx->store.cps = OC_CPS_FAILED;
ctx->store.status |= OC_CLOUD_FAILURE; ctx->store.status |= OC_CLOUD_FAILURE;
if (ctx->last_error == 0) { if (ctx->last_error == 0) {
cloud_set_last_error(ctx, CLOUD_ERROR_RESPONSE); cloud_set_last_error(ctx, CLOUD_ERROR_RESPONSE);
...@@ -430,7 +430,7 @@ error: ...@@ -430,7 +430,7 @@ error:
if (ctx->last_error == 0) { if (ctx->last_error == 0) {
cloud_set_last_error(ctx, CLOUD_ERROR_REFRESH_ACCESS_TOKEN); cloud_set_last_error(ctx, CLOUD_ERROR_REFRESH_ACCESS_TOKEN);
} }
ctx->cps = OC_CPS_FAILED; ctx->store.cps = OC_CPS_FAILED;
ctx->store.status |= OC_CLOUD_FAILURE; ctx->store.status |= OC_CLOUD_FAILURE;
return -1; return -1;
} }
......
...@@ -66,7 +66,7 @@ cloud_response(oc_cloud_context_t *ctx) ...@@ -66,7 +66,7 @@ cloud_response(oc_cloud_context_t *ctx)
root, sid, (oc_string(ctx->store.sid) ? oc_string(ctx->store.sid) : "")); root, sid, (oc_string(ctx->store.sid) ? oc_string(ctx->store.sid) : ""));
oc_rep_set_int(root, clec, (int)ctx->last_error); oc_rep_set_int(root, clec, (int)ctx->last_error);
const char *cps = cps_to_str(ctx->cps); const char *cps = cps_to_str(ctx->store.cps);
if (cps) { if (cps) {
oc_rep_set_text_string(root, cps, cps); oc_rep_set_text_string(root, cps, cps);
} }
...@@ -145,7 +145,7 @@ post_cloud(oc_request_t *request, oc_interface_mask_t interface, ...@@ -145,7 +145,7 @@ post_cloud(oc_request_t *request, oc_interface_mask_t interface,
OC_DBG("POST request received"); OC_DBG("POST request received");
(void)interface; (void)interface;
switch (ctx->cps) { switch (ctx->store.cps) {
case OC_CPS_UNINITIALIZED: case OC_CPS_UNINITIALIZED:
case OC_CPS_READYTOREGISTER: case OC_CPS_READYTOREGISTER:
case OC_CPS_FAILED: case OC_CPS_FAILED:
......
...@@ -64,10 +64,12 @@ encode_cloud_with_map(CborEncoder *object_map, const oc_cloud_store_t *store) ...@@ -64,10 +64,12 @@ encode_cloud_with_map(CborEncoder *object_map, const oc_cloud_store_t *store)
oc_rep_set_text_string(*object, auth_provider, oc_rep_set_text_string(*object, auth_provider,
oc_string(store->auth_provider)); oc_string(store->auth_provider));
oc_rep_set_text_string(*object, uid, oc_string(store->uid)); oc_rep_set_text_string(*object, uid, oc_string(store->uid));
oc_rep_set_text_string(*object, sid, oc_string(store->sid));
oc_rep_set_text_string(*object, access_token, oc_string(store->access_token)); oc_rep_set_text_string(*object, access_token, oc_string(store->access_token));
oc_rep_set_text_string(*object, refresh_token, oc_rep_set_text_string(*object, refresh_token,
oc_string(store->refresh_token)); oc_string(store->refresh_token));
oc_rep_set_int(*object, status, store->status); oc_rep_set_int(*object, status, store->status);
oc_rep_set_int(*object, cps, store->cps);
} }
static void static void
...@@ -145,6 +147,9 @@ cloud_store_decode(oc_rep_t *rep, oc_cloud_store_t *store) ...@@ -145,6 +147,9 @@ cloud_store_decode(oc_rep_t *rep, oc_cloud_store_t *store)
if (len == 9 && memcmp(oc_string(t->name), "ci_server", 9) == 0) { if (len == 9 && memcmp(oc_string(t->name), "ci_server", 9) == 0) {
cloud_set_string(&store->ci_server, oc_string(t->value.string), cloud_set_string(&store->ci_server, oc_string(t->value.string),
oc_string_len(t->value.string)); oc_string_len(t->value.string));
} else if (len == 3 && memcmp(oc_string(t->name), "sid", 3) == 0) {
cloud_set_string(&store->sid, oc_string(t->value.string),
oc_string_len(t->value.string));
} else if (len == 13 && } else if (len == 13 &&
memcmp(oc_string(t->name), "auth_provider", 13) == 0) { memcmp(oc_string(t->name), "auth_provider", 13) == 0) {
cloud_set_string(&store->auth_provider, oc_string(t->value.string), cloud_set_string(&store->auth_provider, oc_string(t->value.string),
...@@ -168,6 +173,8 @@ cloud_store_decode(oc_rep_t *rep, oc_cloud_store_t *store) ...@@ -168,6 +173,8 @@ cloud_store_decode(oc_rep_t *rep, oc_cloud_store_t *store)
case OC_REP_INT: case OC_REP_INT:
if (len == 6 && memcmp(oc_string(t->name), "status", 6) == 0) { if (len == 6 && memcmp(oc_string(t->name), "status", 6) == 0) {
store->status = (uint8_t)t->value.integer; store->status = (uint8_t)t->value.integer;
} else if (len == 3 && memcmp(oc_string(t->name), "cps", 3) == 0) {
store->cps = (uint8_t)t->value.integer;
} else { } else {
OC_ERR("[CLOUD_STORE] Unknown property %s", oc_string(t->name)); OC_ERR("[CLOUD_STORE] Unknown property %s", oc_string(t->name));
return -1; return -1;
......
...@@ -509,16 +509,17 @@ oc_endpoint_string_parse_path(oc_string_t *endpoint_str, oc_string_t *path) ...@@ -509,16 +509,17 @@ oc_endpoint_string_parse_path(oc_string_t *endpoint_str, oc_string_t *path)
const char *address = NULL; const char *address = NULL;
address = strstr(oc_string(*endpoint_str), "://"); address = strstr(oc_string(*endpoint_str), "://");
if(!address) { if (!address) {
return -1; return -1;
} }
// 3 is string length of "://" // 3 is string length of "://"
address += 3; address += 3;
size_t len = oc_string_len(*endpoint_str) - (address - oc_string(*endpoint_str)); size_t len =
oc_string_len(*endpoint_str) - (address - oc_string(*endpoint_str));
// the smallest possible address is '0' anything smaller is invalid. // the smallest possible address is '0' anything smaller is invalid.
if(len < 1) { if (len < 1) {
return -1; return -1;
} }
/* Extract a uri path if available */ /* Extract a uri path if available */
...@@ -556,7 +557,7 @@ oc_ipv6_endpoint_is_link_local(oc_endpoint_t *endpoint) ...@@ -556,7 +557,7 @@ oc_ipv6_endpoint_is_link_local(oc_endpoint_t *endpoint)
} }
int int
oc_endpoint_compare_address(oc_endpoint_t *ep1, oc_endpoint_t *ep2) oc_endpoint_compare_address(const oc_endpoint_t *ep1, const oc_endpoint_t *ep2)
{ {
if (!ep1 || !ep2) if (!ep1 || !ep2)
return -1; return -1;
......
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
#include <stdint.h> #include <stdint.h>
#include <stdio.h> #include <stdio.h>
#include "oc_config.h"
#include "port/oc_assert.h" #include "port/oc_assert.h"
#include "port/oc_clock.h" #include "port/oc_clock.h"
#include "port/oc_connectivity.h" #include "port/oc_connectivity.h"
......
...@@ -492,6 +492,7 @@ read_pem(const char *file_path, char *buffer, size_t *buffer_len) ...@@ -492,6 +492,7 @@ read_pem(const char *file_path, char *buffer, size_t *buffer_len)
return -1; return -1;
} }
fclose(fp); fclose(fp);
buffer[pem_len] = '\0';
*buffer_len = (size_t)pem_len; *buffer_len = (size_t)pem_len;
return 0; return 0;
} }
......
...@@ -46,11 +46,11 @@ display_menu(void) ...@@ -46,11 +46,11 @@ display_menu(void)
} }
// define application specific values. // define application specific values.
static const char *spec_version = "ocf.2.5.0"; static const char *spec_version = "ocf.2.0.5";
static const char *data_model_version = "ocf.res.1.3.0"; static const char *data_model_version = "ocf.res.1.3.0";
static const char *device_rt = "oic.d.cloudDevice"; static const char *device_rt = "oic.d.cloudDevice";
static const char *device_name = "CloudDevice"; static const char *device_name = "CloudClient";
static const char *manufacturer = "ocfcloud.com"; static const char *manufacturer = "ocfcloud.com";
...@@ -450,8 +450,13 @@ main(int argc, char *argv[]) ...@@ -450,8 +450,13 @@ main(int argc, char *argv[])
{ {
if (argc == 1) { if (argc == 1) {
PRINT("./cloud_client <device-name-without-spaces> <auth-code> <cis> <sid> " PRINT("./cloud_client <device-name-without-spaces> <auth-code> <cis> <sid> "
"<apn>\n" "<apn>\n");
"Using the default values\n"); #ifndef OC_SECURITY
PRINT("Using default parameters: device_name: %s, auth_code: %s, cis: %s, "
"sid: %s, "
"apn: %s\n",
device_name, auth_code, cis, sid, apn);
#endif /* !OC_SECURITY */
} }
if (argc > 1) { if (argc > 1) {
device_name = argv[1]; device_name = argv[1];
...@@ -474,10 +479,6 @@ main(int argc, char *argv[]) ...@@ -474,10 +479,6 @@ main(int argc, char *argv[])
PRINT("apn: %s\n", argv[5]); PRINT("apn: %s\n", argv[5]);
} }
PRINT("device_name: %s, auth_code: %s, cis: %s, sid: %s, "
"apn: %s\n",
device_name, auth_code, cis, sid, apn);
#if defined(_WIN32) #if defined(_WIN32)
InitializeCriticalSection(&cs); InitializeCriticalSection(&cs);
InitializeConditionVariable(&cv); InitializeConditionVariable(&cv);
......
...@@ -134,12 +134,12 @@ run(void) ...@@ -134,12 +134,12 @@ run(void)
#endif #endif
// define application specific values. // define application specific values.
static const char *spec_version = "ocf.1.0.0"; static const char *spec_version = "ocf.2.0.5";
static const char *data_model_version = "ocf.res.1.0.0"; static const char *data_model_version = "ocf.res.1.3.0";
static const char *resource_rt = "core.light"; static const char *resource_rt = "core.light";
static const char *device_rt = "oic.d.cloudDevice"; static const char *device_rt = "oic.d.cloudDevice";
static const char *device_name = "Cloud Device"; static const char *device_name = "CloudServer";
static const char *manufacturer = "ocfcloud.com"; static const char *manufacturer = "ocfcloud.com";
...@@ -363,13 +363,15 @@ factory_presets_cb(size_t device, void *data) ...@@ -363,13 +363,15 @@ factory_presets_cb(size_t device, void *data)
int int
main(int argc, char *argv[]) main(int argc, char *argv[])
{ {
PRINT("Default parameters: device_name: %s, auth_code: %s, cis: %s, sid: %s, "
"apn: %s\n",
device_name, auth_code, cis, sid, apn);
if (argc == 1) { if (argc == 1) {
PRINT("./cloud_client <device-name-without-spaces> <auth-code> <cis> <sid> " PRINT("./cloud_server <device-name-without-spaces> <auth-code> <cis> <sid> "
"<apn>\n" "<apn>\n");
"Using the default values\n"); #ifndef OC_SECURITY
PRINT("Using default parameters: device_name: %s, auth_code: %s, cis: %s, "
"sid: %s, "
"apn: %s\n",
device_name, auth_code, cis, sid, apn);
#endif /* !OC_SECURITY */
} }
if (argc > 1) { if (argc > 1) {
device_name = argv[1]; device_name = argv[1];
......
...@@ -38,8 +38,7 @@ ...@@ -38,8 +38,7 @@
#include "port/oc_storage.h" #include "port/oc_storage.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" extern "C" {
{
#endif #endif
/** /**
...@@ -560,6 +559,64 @@ void oc_reset(); ...@@ -560,6 +559,64 @@ void oc_reset();
*/ */
void oc_reset_device(size_t device); void oc_reset_device(size_t device);
/**
* Callback invoked when the "owned" property of the doxm is changed
*
* @param device_uuid the UUID of the device that change ownership
* @param device_index of the logical device that changed ownership
* @param owned if true the device has been claimed by an onboarding tool
* @param user_data context pointer
*/
typedef void (*oc_ownership_status_cb_t)(const oc_uuid_t *device_uuid,