buildCoapResponse

@NotNull
open fun <T : McuMgrResponse?> buildCoapResponse(@NotNull scheme: @NotNull McuMgrScheme, bytes: @NotNull Array<Byte>, header: @NotNull Array<Byte>, payload: @NotNull Array<Byte>, codeClass: Int, codeDetail: Int, type: Class<T>): @NotNull T

Build a CoAP McuMgrResponse. This method will throw a McuMgrCoapException if the CoAP response code indicates an error.

Return

The McuMgrResponse.

Parameters

scheme

the transport scheme used (should be either COAP_BLE or COAP_UDP).

bytes

the packet's bytes, including the CoAP header.

header

the raw McuManager header.

payload

the raw McuManager payload.

codeClass

the class of the CoAP response code.

codeDetail

the detail of the CoAP response code.

type

the type of response to parse the payload into.

<T>

the type of response to parse the payload into.

Throws

if parsing the payload into the object (type T) failed

if the CoAP code class indicates a CoAP error response