net: lwm2m: define a CREATE operation
Prior to this patch, a CREATE operation was handled as a WRITE operation after the object instance was created. This becomes problematic when handling of optional resources differs between these 2 operations. Let's introduce an actual CREATE operation and use it later to create these differences. Signed-off-by: Michael Scott <michael.scott@linaro.org>
This commit is contained in:
parent
75016c7b97
commit
22b11ba8fe
2 changed files with 9 additions and 4 deletions
|
@ -2043,7 +2043,7 @@ static int handle_request(struct zoap_packet *request,
|
|||
case ZOAP_METHOD_POST:
|
||||
if (path.level < 2) {
|
||||
/* write/create a object instance */
|
||||
context.operation = LWM2M_OP_WRITE;
|
||||
context.operation = LWM2M_OP_CREATE;
|
||||
} else {
|
||||
context.operation = LWM2M_OP_EXECUTE;
|
||||
}
|
||||
|
@ -2123,6 +2123,7 @@ static int handle_request(struct zoap_packet *request,
|
|||
break;
|
||||
|
||||
case LWM2M_OP_WRITE:
|
||||
case LWM2M_OP_CREATE:
|
||||
r = do_write_op(obj, &context, format);
|
||||
break;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue