Skip to content

Commit b678895

Browse files
rbtchcAnas Nashif
authored and
Anas Nashif
committed
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 <[email protected]>
1 parent 03151fc commit b678895

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

subsys/net/lib/lwm2m/lwm2m_engine.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2512,14 +2512,19 @@ static int handle_request(struct coap_packet *request,
25122512
break;
25132513

25142514
case COAP_METHOD_POST:
2515-
if (path.level < 2) {
2516-
/* write/create a object instance */
2515+
if (path.level == 1) {
2516+
/* create an object instance */
25172517
context.operation = LWM2M_OP_CREATE;
25182518
msg->code = COAP_RESPONSE_CODE_CREATED;
2519+
} else if (path.level == 2) {
2520+
/* write values to an object instance */
2521+
context.operation = LWM2M_OP_WRITE;
2522+
msg->code = COAP_RESPONSE_CODE_CHANGED;
25192523
} else {
25202524
context.operation = LWM2M_OP_EXECUTE;
25212525
msg->code = COAP_RESPONSE_CODE_CHANGED;
25222526
}
2527+
25232528
break;
25242529

25252530
case COAP_METHOD_PUT:

0 commit comments

Comments
 (0)