use of org.eclipse.californium.core.coap.Response in project thingsboard by thingsboard.
the class JsonCoapAdaptor method convertToServerRpcResponse.
private Response convertToServerRpcResponse(SessionContext ctx, ToServerRpcResponseMsg msg) {
if (msg.isSuccess()) {
Response response = new Response(ResponseCode.CONTENT);
JsonElement result = JsonConverter.toJson(msg);
response.setPayload(result.toString());
return response;
} else {
return convertError(Optional.of(new RuntimeException("Server RPC response is empty!")));
}
}
Aggregations