Commit 648b5838 authored by Kiara Navarro's avatar Kiara Navarro Committed by Carles Cufi
Browse files

samples: subsys: lorawan: callback registration for handle descriptor



include the use of callback registration to handle descriptor
whenever `FragSessionSetupReq` is sent from fuota server.

Signed-off-by: default avatarKiara Navarro <sophiekovalevsky@fedoraproject.org>
parent 6b2a476c
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -41,6 +41,18 @@ static void datarate_changed(enum lorawan_datarate dr)
	LOG_INF("New Datarate: DR %d, Max Payload %d", dr, max_size);
}

int descriptor_cb(uint32_t descriptor)
{
	/*
	 * In an actual application the firmware may be able to handle
	 * the descriptor field
	 */

	LOG_INF("Received descriptor %u", descriptor);

	return 0;
}

static void fuota_finished(void)
{
	LOG_INF("FUOTA finished. Reset device to apply firmware upgrade.");
@@ -114,6 +126,8 @@ int main(void)
	 */
	lorawan_frag_transport_run(fuota_finished);

	lorawan_frag_transport_register_descriptor_callback(descriptor_cb);

	/*
	 * Regular uplinks are required to open downlink slots in class A for
	 * FUOTA setup by the server.