Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
I
iotivity-lite
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
41
Issues
41
List
Boards
Labels
Service Desk
Milestones
Merge Requests
12
Merge Requests
12
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
IoTivity
iotivity-lite
Commits
40ab50a9
Commit
40ab50a9
authored
Apr 26, 2020
by
Kishen Maloor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
oc_cloud:persist cloud provisioning status
Signed-off-by:
Kishen Maloor
<
kishen.maloor@intel.com
>
parent
7c50703a
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
17 additions
and
17 deletions
+17
-17
api/cloud/oc_cloud.c
api/cloud/oc_cloud.c
+4
-4
api/cloud/oc_cloud_apis.c
api/cloud/oc_cloud_apis.c
+2
-2
api/cloud/oc_cloud_manager.c
api/cloud/oc_cloud_manager.c
+5
-7
api/cloud/oc_cloud_resource.c
api/cloud/oc_cloud_resource.c
+2
-2
api/cloud/oc_cloud_store.c
api/cloud/oc_cloud_store.c
+3
-0
include/oc_cloud.h
include/oc_cloud.h
+1
-2
No files found.
api/cloud/oc_cloud.c
View file @
40ab50a9
...
...
@@ -113,7 +113,7 @@ cloud_deregister_on_reset_internal(oc_cloud_context_t *ctx,
cloud_store_initialize
(
&
ctx
->
store
);
cloud_manager_stop
(
ctx
);
ctx
->
last_error
=
0
;
ctx
->
cps
=
0
;
ctx
->
store
.
cps
=
0
;
}
#endif
/* OC_SECURITY */
...
...
@@ -137,7 +137,7 @@ oc_cloud_reset_context(size_t device)
cloud_store_initialize
(
&
ctx
->
store
);
cloud_manager_stop
(
ctx
);
ctx
->
last_error
=
0
;
ctx
->
cps
=
0
;
ctx
->
store
.
cps
=
0
;
return
0
;
}
...
...
@@ -168,7 +168,7 @@ oc_cloud_provision_conf_resource(oc_cloud_context_t *ctx, const char *server,
}
ctx
->
store
.
status
=
OC_CLOUD_INITIALIZED
;
ctx
->
cps
=
OC_CPS_READYTOREGISTER
;
ctx
->
store
.
cps
=
OC_CPS_READYTOREGISTER
;
cloud_store_dump_async
(
&
ctx
->
store
);
...
...
@@ -204,7 +204,7 @@ cloud_update_by_resource(oc_cloud_context_t *ctx,
cloud_set_string
(
&
ctx
->
store
.
sid
,
data
->
sid
,
data
->
sid_len
);
}
ctx
->
store
.
status
=
OC_CLOUD_INITIALIZED
;
ctx
->
cps
=
OC_CPS_READYTOREGISTER
;
ctx
->
store
.
cps
=
OC_CPS_READYTOREGISTER
;
if
(
ctx
->
cloud_manager
)
{
cloud_reconnect
(
ctx
);
}
...
...
api/cloud/oc_cloud_apis.c
View file @
40ab50a9
...
...
@@ -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
),
ctx
->
device
,
oc_cloud_register_handler
,
p
))
{
cannotConnect
=
false
;
ctx
->
cps
=
OC_CPS_REGISTERING
;
ctx
->
store
.
cps
=
OC_CPS_REGISTERING
;
}
if
(
cannotConnect
)
{
cloud_set_last_error
(
ctx
,
CLOUD_ERROR_CONNECT
);
...
...
@@ -241,7 +241,7 @@ cloud_deregistered_internal(oc_client_response_t *data)
ctx
->
store
.
status
=
OC_CLOUD_DEREGISTERED
;
}
ctx
->
cps
=
OC_CPS_READYTOREGISTER
;
ctx
->
store
.
cps
=
OC_CPS_READYTOREGISTER
;
if
(
p
->
cb
)
{
p
->
cb
(
ctx
,
ctx
->
store
.
status
,
p
->
data
);
...
...
api/cloud/oc_cloud_manager.c
View file @
40ab50a9
...
...
@@ -146,8 +146,6 @@ _register_handler(oc_cloud_context_t *ctx, oc_client_response_t *data)
oc_rep_t
*
payload
=
data
->
payload
;
ctx
->
store
.
status
=
0
;
char
*
value
=
NULL
;
size_t
size
=
0
;
...
...
@@ -195,12 +193,12 @@ _register_handler(oc_cloud_context_t *ctx, oc_client_response_t *data)
cloud_set_last_error
(
ctx
,
CLOUD_OK
);
ctx
->
store
.
status
|=
OC_CLOUD_REGISTERED
;
ctx
->
cps
=
OC_CPS_REGISTERED
;
ctx
->
store
.
cps
=
OC_CPS_REGISTERED
;
return
0
;
error:
ctx
->
cps
=
OC_CPS_FAILED
;
ctx
->
store
.
cps
=
OC_CPS_FAILED
;
ctx
->
store
.
status
|=
OC_CLOUD_FAILURE
;
if
(
ctx
->
last_error
==
0
)
{
cloud_set_last_error
(
ctx
,
CLOUD_ERROR_RESPONSE
);
...
...
@@ -259,7 +257,7 @@ cloud_register(void *data)
oc_string
(
ctx
->
store
.
uid
),
oc_string
(
ctx
->
store
.
access_token
),
ctx
->
device
,
cloud_register_handler
,
data
))
{
cannotConnect
=
false
;
ctx
->
cps
=
OC_CPS_REGISTERING
;
ctx
->
store
.
cps
=
OC_CPS_REGISTERING
;
}
if
(
cannotConnect
)
{
cloud_set_last_error
(
ctx
,
CLOUD_ERROR_CONNECT
);
...
...
@@ -297,7 +295,7 @@ _login_handler(oc_cloud_context_t *ctx, oc_client_response_t *data)
return
0
;
error:
ctx
->
cps
=
OC_CPS_FAILED
;
ctx
->
store
.
cps
=
OC_CPS_FAILED
;
ctx
->
store
.
status
|=
OC_CLOUD_FAILURE
;
if
(
ctx
->
last_error
==
0
)
{
cloud_set_last_error
(
ctx
,
CLOUD_ERROR_RESPONSE
);
...
...
@@ -430,7 +428,7 @@ error:
if
(
ctx
->
last_error
==
0
)
{
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
;
return
-
1
;
}
...
...
api/cloud/oc_cloud_resource.c
View file @
40ab50a9
...
...
@@ -66,7 +66,7 @@ cloud_response(oc_cloud_context_t *ctx)
root
,
sid
,
(
oc_string
(
ctx
->
store
.
sid
)
?
oc_string
(
ctx
->
store
.
sid
)
:
""
));
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
)
{
oc_rep_set_text_string
(
root
,
cps
,
cps
);
}
...
...
@@ -145,7 +145,7 @@ post_cloud(oc_request_t *request, oc_interface_mask_t interface,
OC_DBG
(
"POST request received"
);
(
void
)
interface
;
switch
(
ctx
->
cps
)
{
switch
(
ctx
->
store
.
cps
)
{
case
OC_CPS_UNINITIALIZED
:
case
OC_CPS_READYTOREGISTER
:
case
OC_CPS_FAILED
:
...
...
api/cloud/oc_cloud_store.c
View file @
40ab50a9
...
...
@@ -68,6 +68,7 @@ encode_cloud_with_map(CborEncoder *object_map, const oc_cloud_store_t *store)
oc_rep_set_text_string
(
*
object
,
refresh_token
,
oc_string
(
store
->
refresh_token
));
oc_rep_set_int
(
*
object
,
status
,
store
->
status
);
oc_rep_set_int
(
*
object
,
cps
,
store
->
cps
);
}
static
void
...
...
@@ -168,6 +169,8 @@ cloud_store_decode(oc_rep_t *rep, oc_cloud_store_t *store)
case
OC_REP_INT
:
if
(
len
==
6
&&
memcmp
(
oc_string
(
t
->
name
),
"status"
,
6
)
==
0
)
{
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
{
OC_ERR
(
"[CLOUD_STORE] Unknown property %s"
,
oc_string
(
t
->
name
));
return
-
1
;
...
...
include/oc_cloud.h
View file @
40ab50a9
...
...
@@ -62,6 +62,7 @@ typedef struct oc_cloud_store_t
oc_string_t
refresh_token
;
oc_string_t
sid
;
uint8_t
status
;
oc_cps_t
cps
;
size_t
device
;
}
oc_cloud_store_t
;
...
...
@@ -104,8 +105,6 @@ typedef struct oc_cloud_context_t
oc_link_t
*
rd_delete_resources
;
bool
rd_delete_all
;
oc_cps_t
cps
;
oc_resource_t
*
cloud_conf
;
bool
cloud_manager
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment