-
Notifications
You must be signed in to change notification settings - Fork 407
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add first minimal support of Observe Request (SendSync Only)
- Loading branch information
1 parent
21134c6
commit 4c1913b
Showing
7 changed files
with
209 additions
and
93 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
...rver/src/main/java/org/eclipse/leshan/transport/javacoap/observation/ObservationUtil.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2023 Sierra Wireless and others. | ||
* | ||
* All rights reserved. This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License v2.0 | ||
* and Eclipse Distribution License v1.0 which accompany this distribution. | ||
* | ||
* The Eclipse Public License is available at | ||
* http://www.eclipse.org/legal/epl-v20.html | ||
* and the Eclipse Distribution License is available at | ||
* http://www.eclipse.org/org/documents/edl-v10.html. | ||
* | ||
* Contributors: | ||
* Sierra Wireless - initial API and implementation | ||
*******************************************************************************/ | ||
package org.eclipse.leshan.transport.javacoap.observation; | ||
|
||
import org.eclipse.leshan.core.observation.ObservationIdentifier; | ||
import org.eclipse.leshan.core.observation.SingleObservation; | ||
import org.eclipse.leshan.core.request.ContentFormat; | ||
import org.eclipse.leshan.core.request.ObserveRequest; | ||
|
||
import com.mbed.coap.packet.CoapResponse; | ||
import com.mbed.coap.packet.Opaque; | ||
|
||
public class ObservationUtil { | ||
|
||
public static SingleObservation createSingleObservation(String registationID, ObserveRequest lwm2mRequest, | ||
Opaque token, CoapResponse coapResponse) { | ||
ContentFormat contentFormat = null; | ||
if (coapResponse != null) { | ||
contentFormat = ContentFormat.fromCode(coapResponse.options().getContentFormat()); | ||
} | ||
return new SingleObservation(new ObservationIdentifier(token.getBytes()), registationID, lwm2mRequest.getPath(), | ||
contentFormat, null, null); | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.