net: lwm2m: POST with <obj>/<obj instance> is a WRITE op
Per LwM2M specification V1_0_1-20170704-A, table 25. Signed-off-by: Robert Chou <robert.ch.chou@acer.com>
This commit is contained in:
parent
03151fc8d7
commit
b678895a6d
1 changed files with 7 additions and 2 deletions
|
@ -2512,14 +2512,19 @@ static int handle_request(struct coap_packet *request,
|
|||
break;
|
||||
|
||||
case COAP_METHOD_POST:
|
||||
if (path.level < 2) {
|
||||
/* write/create a object instance */
|
||||
if (path.level == 1) {
|
||||
/* create an object instance */
|
||||
context.operation = LWM2M_OP_CREATE;
|
||||
msg->code = COAP_RESPONSE_CODE_CREATED;
|
||||
} else if (path.level == 2) {
|
||||
/* write values to an object instance */
|
||||
context.operation = LWM2M_OP_WRITE;
|
||||
msg->code = COAP_RESPONSE_CODE_CHANGED;
|
||||
} else {
|
||||
context.operation = LWM2M_OP_EXECUTE;
|
||||
msg->code = COAP_RESPONSE_CODE_CHANGED;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case COAP_METHOD_PUT:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue