<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>GPS and accelerometer data to own AWS server</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/70097/gps-and-accelerometer-data-to-own-aws-server</link><description>Hi, 
 I am a little confused between GPS and AGPS sample code provided by nordic. can you help me to understand it? 
 I just want to send GPS and accelerometer data of thingy91 to my own AWS IOT server. which one would be the easiest way to use to satisfy</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 30 Nov 2021 13:25:04 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/70097/gps-and-accelerometer-data-to-own-aws-server" /><item><title>RE: GPS and accelerometer data to own AWS server</title><link>https://devzone.nordicsemi.com/thread/341310?ContentTypeID=1</link><pubDate>Tue, 30 Nov 2021 13:25:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ac4e68aa-cb01-4a7c-88cc-7ca6a52e967b</guid><dc:creator>tracking</dc:creator><description>&lt;p&gt;&lt;span&gt;Hello ! Were you able to send GPS data to AWS? Thanks :)&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: GPS and accelerometer data to own AWS server</title><link>https://devzone.nordicsemi.com/thread/288991?ContentTypeID=1</link><pubDate>Wed, 13 Jan 2021 15:53:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0a4de793-067b-438a-9f8c-02f2d5f20fe4</guid><dc:creator>Hakon</dc:creator><description>[quote user="Rkidechaa"]can we set multiple thingies to send data to the AWS IOT account?[/quote]
&lt;p&gt;&amp;nbsp;Yes, that should be possible. You need to set up individual certificates though. Have you done that?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: GPS and accelerometer data to own AWS server</title><link>https://devzone.nordicsemi.com/thread/288515?ContentTypeID=1</link><pubDate>Tue, 12 Jan 2021 05:30:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:97ca23e2-594d-4ef8-a236-c44c5e5e3cef</guid><dc:creator>Rkidechaa</dc:creator><description>[quote userid="73166" url="~/f/nordic-q-a/70097/gps-and-accelerometer-data-to-own-aws-server/288168#288168"] What SIM/operator are you using. What location do you try to connect from?[/quote]
&lt;p&gt;SIM operator is Ibasis only. Location =&amp;nbsp; USA -Texas, Arlington.&lt;/p&gt;
&lt;p&gt;I have successfully received the accelerometer data on my AWS server. Now when I am trying to send data from another thingy on the same server getting an error.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;
2021-01-12T05:22:18.759Z DEBUG modem &amp;lt;&amp;lt; *** Booting Zephyr OS build v2.4.0-ncs1-1710-g5a7b4eb71047  ***
2021-01-12T05:22:18.760Z DEBUG modem &amp;lt;&amp;lt; I: BSDlib is not yet initialized, AT commands not sent
2021-01-12T05:22:18.761Z DEBUG modem &amp;lt;&amp;lt; I: Configuration of MAGPIO and COEX0 is left to drivers
2021-01-12T05:22:18.762Z DEBUG modem &amp;lt;&amp;lt; The AWS IoT sample started, version: v1.0.0
2021-01-12T05:22:20.656Z DEBUG modem &amp;lt;&amp;lt; LTE cell changed: Cell ID: 133272592, Tracking area: 27174
2021-01-12T05:22:20.659Z DEBUG modem &amp;lt;&amp;lt; PSM parameter update: TAU: -1, Active time: -1
2021-01-12T05:22:20.700Z DEBUG modem &amp;lt;&amp;lt; RRC mode: Connected
2021-01-12T05:22:22.563Z DEBUG modem &amp;lt;&amp;lt; Network registration status: Connected - roaming
2021-01-12T05:22:23.218Z DEBUG modem &amp;lt;&amp;lt; DATE_TIME_OBTAINED_NTP
2021-01-12T05:22:23.222Z DEBUG modem &amp;lt;&amp;lt; Next connection retry in 30 seconds
2021-01-12T05:22:23.224Z DEBUG modem &amp;lt;&amp;lt; AWS_IOT_EVT_CONNECTING
2021-01-12T05:22:23.520Z DEBUG modem &amp;lt;&amp;lt; E: mqtt_connect, error: -95
2021-01-12T05:22:23.523Z DEBUG modem &amp;lt;&amp;lt; AWS_IOT_EVT_CONNECTING
2021-01-12T05:22:29.284Z DEBUG modem &amp;lt;&amp;lt; RRC mode: Idle
2021-01-12T05:22:53.220Z DEBUG modem &amp;lt;&amp;lt; Next connection retry in 30 seconds
2021-01-12T05:22:53.222Z DEBUG modem &amp;lt;&amp;lt; AWS_IOT_EVT_CONNECTING
2021-01-12T05:22:53.320Z DEBUG modem &amp;lt;&amp;lt; RRC mode: Connected
2021-01-12T05:22:53.535Z DEBUG modem &amp;lt;&amp;lt; E: mqtt_connect, error: -95
2021-01-12T05:22:53.537Z DEBUG modem &amp;lt;&amp;lt; AWS_IOT_EVT_CONNECTING
2021-01-12T05:22:59.287Z DEBUG modem &amp;lt;&amp;lt; RRC mode: Idle
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;can we set multiple thingies to send data to the AWS IOT account?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: GPS and accelerometer data to own AWS server</title><link>https://devzone.nordicsemi.com/thread/288168?ContentTypeID=1</link><pubDate>Fri, 08 Jan 2021 12:38:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9c822c48-a474-4ddb-b917-9552a0e2fc7b</guid><dc:creator>Hakon</dc:creator><description>[quote user="Rkidechaa"]both are working fine when run individually.[/quote]
&lt;p&gt;&amp;nbsp;For GPS and LTE to run concurrently, you need to enable PSM. As far as I can tell, from the CEREG return value PSM is not enabled. What SIM/operator are you using. What location do you try to connect from?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: GPS and accelerometer data to own AWS server</title><link>https://devzone.nordicsemi.com/thread/287916?ContentTypeID=1</link><pubDate>Thu, 07 Jan 2021 10:41:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3aa33f09-e97d-4197-a74e-322b6ed2d667</guid><dc:creator>Rkidechaa</dc:creator><description>&lt;p&gt;Hi Hakon,&lt;/p&gt;
&lt;p&gt;Thank you for your reply.&lt;/p&gt;
&lt;p&gt;I want to send the GPS data to my AWS_IOT server. I made changes in the AWS_IOT code and got connected to the server successfully. Then run GPS code both are working fine when run individually.&lt;/p&gt;
&lt;p&gt;As I want to send the GPS data tried to merge the code. As per my understanding, both have different modem configuration settings which not allowed to work properly.&lt;/p&gt;
&lt;p&gt;I have tried to arrange the modem configuration function in a different position. Sometimes AWS_IOT works fine but GPS not and vice-versa.&lt;/p&gt;
&lt;p&gt;If you help to configure the modem will solve the whole problem. It is kind of difficult to play with LTE and GPS as both works concurrently.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;#GPS
# Copyright (c) 2019 Nordic Semiconductor ASA
#
# SPDX-License-Identifier: LicenseRef-BSD-5-Clause-Nordic
#
CONFIG_BSD_LIBRARY=y
CONFIG_STDOUT_CONSOLE=y
CONFIG_UART_INTERRUPT_DRIVEN=y
CONFIG_NEWLIB_LIBC=y
CONFIG_NEWLIB_LIBC_FLOAT_PRINTF=y
CONFIG_AT_CMD=y
CONFIG_AT_NOTIF=y

# Enable SUPL client support
CONFIG_SUPL_CLIENT_LIB=n

# Networking
CONFIG_NETWORKING=y
CONFIG_NET_SOCKETS_OFFLOAD=y
CONFIG_NET_SOCKETS=y
CONFIG_NET_SOCKETS_POSIX_NAMES=y
CONFIG_NET_SOCKETS_SOCKOPT_TLS=y

# Disable native network stack to save some memory
CONFIG_NET_NATIVE=n

# Main thread
CONFIG_HEAP_MEM_POOL_SIZE=4096
CONFIG_MAIN_STACK_SIZE=4096
CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=2048

# Application
CONFIG_GPS_SAMPLE_NMEA_ONLY=n

# General config
CONFIG_NCS_SAMPLES_DEFAULTS=y
CONFIG_REBOOT=y

# LTE link control
CONFIG_LTE_LINK_CONTROL=y
CONFIG_LTE_NETWORK_MODE_LTE_M=y
CONFIG_LTE_AUTO_INIT_AND_CONNECT=n

# Download client (needed by AWS FOTA)
CONFIG_DOWNLOAD_CLIENT=y
CONFIG_DOWNLOAD_CLIENT_STACK_SIZE=4096

# MCUBOOT
CONFIG_BOOTLOADER_MCUBOOT=y
CONFIG_MCUBOOT_IMG_MANAGER=y

# Image manager
CONFIG_IMG_MANAGER=y
CONFIG_FLASH=y
CONFIG_IMG_ERASE_PROGRESSIVELY=y

# AWS FOTA
CONFIG_AWS_FOTA=y
CONFIG_FOTA_DOWNLOAD=y
CONFIG_DFU_TARGET=y

# CJSON
CONFIG_CJSON_LIB=y

# Date Time library
CONFIG_DATE_TIME=y

# Modem information
CONFIG_MODEM_INFO=y


# BSD library
CONFIG_BSD_LIBRARY_SYS_INIT=y

# AT Host
CONFIG_AT_HOST_LIBRARY=y

# AWS IoT library
CONFIG_AWS_IOT=y
CONFIG_AWS_IOT_CLIENT_ID_STATIC=&amp;quot;*************&amp;quot;
CONFIG_AWS_IOT_BROKER_HOST_NAME=&amp;quot;*************&amp;quot;
CONFIG_AWS_IOT_SEC_TAG=201
CONFIG_AWS_IOT_APP_SUBSCRIPTION_LIST_COUNT=2
CONFIG_AWS_IOT_TOPIC_UPDATE_DELTA_SUBSCRIBE=y
CONFIG_AWS_IOT_CONNECTION_POLL_THREAD=y
CONFIG_AWS_IOT_LAST_WILL=y
CONFIG_AWS_IOT_TOPIC_GET_ACCEPTED_SUBSCRIBE=y
CONFIG_AWS_IOT_TOPIC_GET_REJECTED_SUBSCRIBE=y&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;/*
 * Copyright (c) 2019 Nordic Semiconductor ASA
 *
 * SPDX-License-Identifier: LicenseRef-BSD-5-Clause-Nordic
 */

#include &amp;lt;zephyr.h&amp;gt;
#include &amp;lt;nrf_socket.h&amp;gt;
#include &amp;lt;net/socket.h&amp;gt;
#include &amp;lt;stdio.h&amp;gt;
#include &amp;lt;stdlib.h&amp;gt;

#include &amp;lt;modem/lte_lc.h&amp;gt;
#include &amp;lt;modem/bsdlib.h&amp;gt;
#include &amp;lt;modem/at_cmd.h&amp;gt;
#include &amp;lt;modem/at_notif.h&amp;gt;
#include &amp;lt;modem/modem_info.h&amp;gt;
#include &amp;lt;bsd.h&amp;gt;

#include &amp;lt;net/aws_iot.h&amp;gt;
#include &amp;lt;power/reboot.h&amp;gt;
#include &amp;lt;date_time.h&amp;gt;
#include &amp;lt;dfu/mcuboot.h&amp;gt;
#include &amp;lt;cJSON.h&amp;gt;
#include &amp;lt;cJSON_os.h&amp;gt;

#ifdef CONFIG_SUPL_CLIENT_LIB
#include &amp;lt;supl_os_client.h&amp;gt;
#include &amp;lt;supl_session.h&amp;gt;
#include &amp;quot;supl_support.h&amp;quot;
#endif

#define AT_XSYSTEMMODE      &amp;quot;AT\%XSYSTEMMODE=1,0,1,0&amp;quot;
#define AT_ACTIVATE_GPS     &amp;quot;AT+CFUN=31&amp;quot;
#define AT_ACTIVATE_LTE     &amp;quot;AT+CFUN=21&amp;quot;
#define AT_DEACTIVATE_LTE   &amp;quot;AT+CFUN=20&amp;quot;

#define GNSS_INIT_AND_START 1
#define GNSS_STOP           2
#define GNSS_RESTART        3

#define AT_CMD_SIZE(x) (sizeof(x) - 1)

#ifdef CONFIG_BOARD_NRF9160DK_NRF9160NS
#define AT_MAGPIO      &amp;quot;AT\%XMAGPIO=1,0,0,1,1,1574,1577&amp;quot;
#ifdef CONFIG_GPS_SAMPLE_ANTENNA_ONBOARD
#define AT_COEX0       &amp;quot;AT\%XCOEX0=1,1,1565,1586&amp;quot;
#elif CONFIG_GPS_SAMPLE_ANTENNA_EXTERNAL
#define AT_COEX0       &amp;quot;AT\%XCOEX0&amp;quot;
#endif
#endif /* CONFIG_BOARD_NRF9160DK_NRF9160NS */

#ifdef CONFIG_BOARD_THINGY91_NRF9160NS
#define AT_MAGPIO      &amp;quot;AT\%XMAGPIO=1,1,1,7,1,746,803,2,698,748,2,1710,2200,&amp;quot; \
			&amp;quot;3,824,894,4,880,960,5,791,849,7,1565,1586&amp;quot;
#ifdef CONFIG_GPS_SAMPLE_ANTENNA_ONBOARD
#define AT_COEX0       &amp;quot;AT\%XCOEX0=1,1,1565,1586&amp;quot;
#elif CONFIG_GPS_SAMPLE_ANTENNA_EXTERNAL
#define AT_COEX0       &amp;quot;AT\%XCOEX0&amp;quot;
#endif
#endif /* CONFIG_BOARD_THINGY91_NRF9160NS */

static const char update_indicator[] = {&amp;#39;\\&amp;#39;, &amp;#39;|&amp;#39;, &amp;#39;/&amp;#39;, &amp;#39;-&amp;#39;};
static const char *const at_commands[] = {
	AT_XSYSTEMMODE,
#if defined(CONFIG_BOARD_NRF9160DK_NRF9160NS) || \
	defined(CONFIG_BOARD_THINGY91_NRF9160NS)
	AT_MAGPIO,
	AT_COEX0,
#endif
	AT_ACTIVATE_GPS
};

static int                   gnss_fd;
static char                  nmea_strings[10][NRF_GNSS_NMEA_MAX_LEN];
static uint32_t                 nmea_string_cnt;

static bool                  got_fix;
static uint64_t                 fix_timestamp;
static nrf_gnss_data_frame_t last_pvt;

K_SEM_DEFINE(lte_ready, 0, 1);

BUILD_ASSERT(!IS_ENABLED(CONFIG_LTE_AUTO_INIT_AND_CONNECT),
		&amp;quot;This sample does not support LTE auto-init and connect&amp;quot;);

#define APP_TOPICS_COUNT CONFIG_AWS_IOT_APP_SUBSCRIPTION_LIST_COUNT

/* Timeout in seconds in which the application will wait for an initial event
 * from the date time library.
 */
#define DATE_TIME_TIMEOUT_S 15

static struct k_delayed_work shadow_update_work;
static struct k_delayed_work connect_work;
static struct k_delayed_work shadow_update_version_work;

K_SEM_DEFINE(lte_connected, 0, 1);
K_SEM_DEFINE(date_time_obtained, 0, 1);

void bsd_recoverable_error_handler(uint32_t error)
{
	printf(&amp;quot;Err: %lu\n&amp;quot;, (unsigned long)error);
}

static int setup_modem(void)
{
	for (int i = 0; i &amp;lt; ARRAY_SIZE(at_commands); i++) {

		if (at_cmd_write(at_commands[i], NULL, 0, NULL) != 0) {
			return -1;
		}
	}

	return 0;
}

#ifdef CONFIG_SUPL_CLIENT_LIB
/* Accepted network statuses read from modem */
static const char status1[] = &amp;quot;+CEREG: 1&amp;quot;;
static const char status2[] = &amp;quot;+CEREG:1&amp;quot;;
static const char status3[] = &amp;quot;+CEREG: 5&amp;quot;;
static const char status4[] = &amp;quot;+CEREG:5&amp;quot;;

static void wait_for_lte(void *context, const char *response)
{
	if (!memcmp(status1, response, AT_CMD_SIZE(status1)) ||
		!memcmp(status2, response, AT_CMD_SIZE(status2)) ||
		!memcmp(status3, response, AT_CMD_SIZE(status3)) ||
		!memcmp(status4, response, AT_CMD_SIZE(status4))) {
		k_sem_give(&amp;amp;lte_ready);
	}
}

static int activate_lte(bool activate)
{
	if (activate) {
		if (at_cmd_write(AT_ACTIVATE_LTE, NULL, 0, NULL) != 0) {
			return -1;
		}

		at_notif_register_handler(NULL, wait_for_lte);
		if (at_cmd_write(&amp;quot;AT+CEREG=2&amp;quot;, NULL, 0, NULL) != 0) {
			return -1;
		}

		k_sem_take(&amp;amp;lte_ready, K_FOREVER);

		at_notif_deregister_handler(NULL, wait_for_lte);
		if (at_cmd_write(&amp;quot;AT+CEREG=0&amp;quot;, NULL, 0, NULL) != 0) {
			return -1;
		}
	} else {
		if (at_cmd_write(AT_DEACTIVATE_LTE, NULL, 0, NULL) != 0) {
			return -1;
		}
	}

	return 0;
}
#endif

static int gnss_ctrl(uint32_t ctrl)
{
	int retval;

	nrf_gnss_fix_retry_t    fix_retry    = 0;
	nrf_gnss_fix_interval_t fix_interval = 1;
	nrf_gnss_delete_mask_t	delete_mask  = 0;
	nrf_gnss_nmea_mask_t	nmea_mask    = NRF_GNSS_NMEA_GSV_MASK |
					       NRF_GNSS_NMEA_GSA_MASK |
					       NRF_GNSS_NMEA_GLL_MASK |
					       NRF_GNSS_NMEA_GGA_MASK |
					       NRF_GNSS_NMEA_RMC_MASK;

	if (ctrl == GNSS_INIT_AND_START) {
		gnss_fd = nrf_socket(NRF_AF_LOCAL,
				     NRF_SOCK_DGRAM,
				     NRF_PROTO_GNSS);

		if (gnss_fd &amp;gt;= 0) {
			printk(&amp;quot;GPS Socket created\n&amp;quot;);
		} else {
			printk(&amp;quot;Could not init socket (err: %d)\n&amp;quot;, gnss_fd);
			return -1;
		}

		retval = nrf_setsockopt(gnss_fd,
					NRF_SOL_GNSS,
					NRF_SO_GNSS_FIX_RETRY,
					&amp;amp;fix_retry,
					sizeof(fix_retry));
		if (retval != 0) {
			printk(&amp;quot;Failed to set fix retry value\n&amp;quot;);
			return -1;
		}

		retval = nrf_setsockopt(gnss_fd,
					NRF_SOL_GNSS,
					NRF_SO_GNSS_FIX_INTERVAL,
					&amp;amp;fix_interval,
					sizeof(fix_interval));
		if (retval != 0) {
			printk(&amp;quot;Failed to set fix interval value\n&amp;quot;);
			return -1;
		}

		retval = nrf_setsockopt(gnss_fd,
					NRF_SOL_GNSS,
					NRF_SO_GNSS_NMEA_MASK,
					&amp;amp;nmea_mask,
					sizeof(nmea_mask));
		if (retval != 0) {
			printk(&amp;quot;Failed to set nmea mask\n&amp;quot;);
			return -1;
		}
	}

	if ((ctrl == GNSS_INIT_AND_START) ||
	    (ctrl == GNSS_RESTART)) {
		retval = nrf_setsockopt(gnss_fd,
					NRF_SOL_GNSS,
					NRF_SO_GNSS_START,
					&amp;amp;delete_mask,
					sizeof(delete_mask));
		if (retval != 0) {
			printk(&amp;quot;Failed to start GPS\n&amp;quot;);
			return -1;
		}
	}

	if (ctrl == GNSS_STOP) {
		retval = nrf_setsockopt(gnss_fd,
					NRF_SOL_GNSS,
					NRF_SO_GNSS_STOP,
					&amp;amp;delete_mask,
					sizeof(delete_mask));
		if (retval != 0) {
			printk(&amp;quot;Failed to stop GPS\n&amp;quot;);
			return -1;
		}
	}

	return 0;
}

static int init_app(void)
{
	int retval;


	if (setup_modem() != 0) {
		printk(&amp;quot;Failed to initialize modem\n&amp;quot;);
		return -1;
	}

	retval = gnss_ctrl(GNSS_INIT_AND_START);

	return retval;
}

static void print_satellite_stats(nrf_gnss_data_frame_t *pvt_data)
{
	uint8_t  tracked          = 0;
	uint8_t  in_fix           = 0;
	uint8_t  unhealthy        = 0;

	for (int i = 0; i &amp;lt; NRF_GNSS_MAX_SATELLITES; ++i) {

		if ((pvt_data-&amp;gt;pvt.sv[i].sv &amp;gt; 0) &amp;amp;&amp;amp;
		    (pvt_data-&amp;gt;pvt.sv[i].sv &amp;lt; 33)) {

			tracked++;

			if (pvt_data-&amp;gt;pvt.sv[i].flags &amp;amp;
					NRF_GNSS_SV_FLAG_USED_IN_FIX) {
				in_fix++;
			}

			if (pvt_data-&amp;gt;pvt.sv[i].flags &amp;amp;
					NRF_GNSS_SV_FLAG_UNHEALTHY) {
				unhealthy++;
			}
		}
	}

	printk(&amp;quot;Tracking: %d Using: %d Unhealthy: %d\n&amp;quot;, tracked,
							 in_fix,
							 unhealthy);
}

static void print_gnss_stats(nrf_gnss_data_frame_t *pvt_data)
{
	if (pvt_data-&amp;gt;pvt.flags &amp;amp; NRF_GNSS_PVT_FLAG_DEADLINE_MISSED) {
		printk(&amp;quot;GNSS notification deadline missed\n&amp;quot;);
	}
	if (pvt_data-&amp;gt;pvt.flags &amp;amp; NRF_GNSS_PVT_FLAG_NOT_ENOUGH_WINDOW_TIME) {
		printk(&amp;quot;GNSS operation blocked by insufficient time windows\n&amp;quot;);
	}
}

static void print_fix_data(nrf_gnss_data_frame_t *pvt_data)
{
	printf(&amp;quot;Longitude:  %f\n&amp;quot;, pvt_data-&amp;gt;pvt.longitude);
	printf(&amp;quot;Latitude:   %f\n&amp;quot;, pvt_data-&amp;gt;pvt.latitude);
	printf(&amp;quot;Altitude:   %f\n&amp;quot;, pvt_data-&amp;gt;pvt.altitude);
	printf(&amp;quot;Speed:      %f\n&amp;quot;, pvt_data-&amp;gt;pvt.speed);
	printf(&amp;quot;Heading:    %f\n&amp;quot;, pvt_data-&amp;gt;pvt.heading);
	printk(&amp;quot;Date:       %02u-%02u-%02u\n&amp;quot;, pvt_data-&amp;gt;pvt.datetime.year,
					       pvt_data-&amp;gt;pvt.datetime.month,
					       pvt_data-&amp;gt;pvt.datetime.day);
	printk(&amp;quot;Time (UTC): %02u:%02u:%02u\n&amp;quot;, pvt_data-&amp;gt;pvt.datetime.hour,
					       pvt_data-&amp;gt;pvt.datetime.minute,
					      pvt_data-&amp;gt;pvt.datetime.seconds);
}

static void print_nmea_data(void)
{
	for (int i = 0; i &amp;lt; nmea_string_cnt; ++i) {
		printk(&amp;quot;%s&amp;quot;, nmea_strings[i]);
	}
}

int process_gps_data(nrf_gnss_data_frame_t *gps_data)
{
	int retval;

	retval = nrf_recv(gnss_fd,
			  gps_data,
			  sizeof(nrf_gnss_data_frame_t),
			  NRF_MSG_DONTWAIT);

	if (retval &amp;gt; 0) {

		switch (gps_data-&amp;gt;data_id) {
		case NRF_GNSS_PVT_DATA_ID:
			memcpy(&amp;amp;last_pvt,
			       gps_data,
			       sizeof(nrf_gnss_data_frame_t));
			nmea_string_cnt = 0;
			got_fix = false;

			if ((gps_data-&amp;gt;pvt.flags &amp;amp;
				NRF_GNSS_PVT_FLAG_FIX_VALID_BIT)
				== NRF_GNSS_PVT_FLAG_FIX_VALID_BIT) {

				got_fix = true;
				fix_timestamp = k_uptime_get();
			}
			break;

		case NRF_GNSS_NMEA_DATA_ID:
			if (nmea_string_cnt &amp;lt; 10) {
				memcpy(nmea_strings[nmea_string_cnt++],
				       gps_data-&amp;gt;nmea,
				       retval);
			}
			break;

		case NRF_GNSS_AGPS_DATA_ID:
#ifdef CONFIG_SUPL_CLIENT_LIB
			printk(&amp;quot;\033[1;1H&amp;quot;);
			printk(&amp;quot;\033[2J&amp;quot;);
			printk(&amp;quot;New AGPS data requested, contacting SUPL server, flags %d\n&amp;quot;,
			       gps_data-&amp;gt;agps.data_flags);
			gnss_ctrl(GNSS_STOP);
			activate_lte(true);
			printk(&amp;quot;Established LTE link\n&amp;quot;);
			if (open_supl_socket() == 0) {
				printf(&amp;quot;Starting SUPL session\n&amp;quot;);
				supl_session(&amp;amp;gps_data-&amp;gt;agps);
				printk(&amp;quot;Done\n&amp;quot;);
				close_supl_socket();
			}
			activate_lte(false);
			gnss_ctrl(GNSS_RESTART);
			k_sleep(K_MSEC(2000));
#endif
			break;

		default:
			break;
		}
	}

	return retval;
}

#ifdef CONFIG_SUPL_CLIENT_LIB
int inject_agps_type(void *agps,
		     size_t agps_size,
		     nrf_gnss_agps_data_type_t type,
		     void *user_data)
{
	ARG_UNUSED(user_data);
	int retval = nrf_sendto(gnss_fd,
				agps,
				agps_size,
				0,
				&amp;amp;type,
				sizeof(type));

	if (retval != 0) {
		printk(&amp;quot;Failed to send AGNSS data, type: %d (err: %d)\n&amp;quot;,
		       type,
		       errno);
		return -1;
	}

	printk(&amp;quot;Injected AGPS data, flags: %d, size: %d\n&amp;quot;, type, agps_size);

	return 0;
}
#endif




static int json_add_obj(cJSON *parent, const char *str, cJSON *item)
{
	cJSON_AddItemToObject(parent, str, item);

	return 0;
}

static int json_add_str(cJSON *parent, const char *str, const char *item)
{
	cJSON *json_str;

	json_str = cJSON_CreateString(item);
	if (json_str == NULL) {
		return -ENOMEM;
	}

	return json_add_obj(parent, str, json_str);
}

static int json_add_number(cJSON *parent, const char *str, double item)
{
	cJSON *json_num;

	json_num = cJSON_CreateNumber(item);
	if (json_num == NULL) {
		return -ENOMEM;
	}

	return json_add_obj(parent, str, json_num);
}

static int shadow_update(bool version_number_include)
{
	int err;
	char *message;
	int64_t message_ts;
	int16_t bat_voltage = 0;

	err = date_time_now(&amp;amp;message_ts);
	if (err) {
		printk(&amp;quot;date_time_now, error: %d\n&amp;quot;, err);
		return err;
	}

#if defined(CONFIG_BSD_LIBRARY)
	/* Request battery voltage data from the modem. */
	err = modem_info_short_get(MODEM_INFO_BATTERY, &amp;amp;bat_voltage);
	if (err != sizeof(bat_voltage)) {
		printk(&amp;quot;modem_info_short_get, error: %d\n&amp;quot;, err);
		return err;
	}
#endif

	cJSON *root_obj = cJSON_CreateObject();
	cJSON *state_obj = cJSON_CreateObject();
	cJSON *reported_obj = cJSON_CreateObject();

	if (root_obj == NULL || state_obj == NULL || reported_obj == NULL) {
		cJSON_Delete(root_obj);
		cJSON_Delete(state_obj);
		cJSON_Delete(reported_obj);
		err = -ENOMEM;
		return err;
	}

	if (version_number_include) {
		err = json_add_str(reported_obj, &amp;quot;app_version&amp;quot;,
				    CONFIG_APP_VERSION);
	} else {
		err = 0;
	}

	err += json_add_number(reported_obj, &amp;quot;batv&amp;quot;, bat_voltage);
	err += json_add_number(reported_obj, &amp;quot;ts&amp;quot;, message_ts);
	err += json_add_obj(state_obj, &amp;quot;reported&amp;quot;, reported_obj);
	err += json_add_obj(root_obj, &amp;quot;state&amp;quot;, state_obj);

	if (err) {
		printk(&amp;quot;json_add, error: %d\n&amp;quot;, err);
		goto cleanup;
	}

	message = cJSON_Print(root_obj);
	if (message == NULL) {
		printk(&amp;quot;cJSON_Print, error: returned NULL\n&amp;quot;);
		err = -ENOMEM;
		goto cleanup;
	}

	struct aws_iot_data tx_data = {
		.qos = MQTT_QOS_0_AT_MOST_ONCE,
		.topic.type = AWS_IOT_SHADOW_TOPIC_UPDATE,
		.ptr = message,
		.len = strlen(message)
	};

	printk(&amp;quot;Publishing: %s to AWS IoT broker\n&amp;quot;, message);

	err = aws_iot_send(&amp;amp;tx_data);
	if (err) {
		printk(&amp;quot;aws_iot_send, error: %d\n&amp;quot;, err);
	}

	cJSON_FreeString(message);

cleanup:

	cJSON_Delete(root_obj);

	return err;
}

static void connect_work_fn(struct k_work *work)
{
	int err;

	err = aws_iot_connect(NULL);
	if (err) {
		printk(&amp;quot;aws_iot_connect, error: %d\n&amp;quot;, err);
	}

	printk(&amp;quot;Next connection retry in %d seconds\n&amp;quot;,
	       CONFIG_CONNECTION_RETRY_TIMEOUT_SECONDS);

	k_delayed_work_submit(&amp;amp;connect_work,
			K_SECONDS(CONFIG_CONNECTION_RETRY_TIMEOUT_SECONDS));
}

static void shadow_update_work_fn(struct k_work *work)
{
	int err;

	err = shadow_update(false);
	if (err) {
		printk(&amp;quot;shadow_update, error: %d\n&amp;quot;, err);
	}

	printk(&amp;quot;Next data publication in %d seconds\n&amp;quot;,
	       CONFIG_PUBLICATION_INTERVAL_SECONDS);

	k_delayed_work_submit(&amp;amp;shadow_update_work,
			      K_SECONDS(CONFIG_PUBLICATION_INTERVAL_SECONDS));
}

static void shadow_update_version_work_fn(struct k_work *work)
{
	int err;

	err = shadow_update(true);
	if (err) {
		printk(&amp;quot;shadow_update, error: %d\n&amp;quot;, err);
	}
}

static void print_received_data(const char *buf, const char *topic,
				size_t topic_len)
{
	char *str = NULL;
	cJSON *root_obj = NULL;

	root_obj = cJSON_Parse(buf);
	if (root_obj == NULL) {
		printk(&amp;quot;cJSON Parse failure&amp;quot;);
		return;
	}

	str = cJSON_Print(root_obj);
	if (str == NULL) {
		printk(&amp;quot;Failed to print JSON object&amp;quot;);
		goto clean_exit;
	}

	printf(&amp;quot;Data received from AWS IoT console:\nTopic: %.*s\nMessage: %s\n&amp;quot;,
	       topic_len, topic, str);

	cJSON_FreeString(str);

clean_exit:
	cJSON_Delete(root_obj);
}

void aws_iot_event_handler(const struct aws_iot_evt *const evt)
{
	switch (evt-&amp;gt;type) {
	case AWS_IOT_EVT_CONNECTING:
		printk(&amp;quot;AWS_IOT_EVT_CONNECTING\n&amp;quot;);
		break;
	case AWS_IOT_EVT_CONNECTED:
		printk(&amp;quot;AWS_IOT_EVT_CONNECTED\n&amp;quot;);

		k_delayed_work_cancel(&amp;amp;connect_work);

		if (evt-&amp;gt;data.persistent_session) {
			printk(&amp;quot;Persistent session enabled\n&amp;quot;);
		}

#if defined(CONFIG_BSD_LIBRARY)
		/** Successfully connected to AWS IoT broker, mark image as
		 *  working to avoid reverting to the former image upon reboot.
		 */
		boot_write_img_confirmed();
#endif

		/** Send version number to AWS IoT broker to verify that the
		 *  FOTA update worked.
		 */
		k_delayed_work_submit(&amp;amp;shadow_update_version_work, K_NO_WAIT);

		/** Start sequential shadow data updates.
		 */
		k_delayed_work_submit(&amp;amp;shadow_update_work,
				K_SECONDS(CONFIG_PUBLICATION_INTERVAL_SECONDS));

#if defined(CONFIG_BSD_LIBRARY)
		int err = lte_lc_psm_req(true);
		if (err) {
			printk(&amp;quot;Requesting PSM failed, error: %d\n&amp;quot;, err);
		}
#endif
		break;
	case AWS_IOT_EVT_READY:
		printk(&amp;quot;AWS_IOT_EVT_READY\n&amp;quot;);
		break;
	case AWS_IOT_EVT_DISCONNECTED:
		printk(&amp;quot;AWS_IOT_EVT_DISCONNECTED\n&amp;quot;);
		k_delayed_work_cancel(&amp;amp;shadow_update_work);

		if (k_delayed_work_pending(&amp;amp;connect_work)) {
			break;
		}

		k_delayed_work_submit(&amp;amp;connect_work, K_NO_WAIT);
		break;
	case AWS_IOT_EVT_DATA_RECEIVED:
		printk(&amp;quot;AWS_IOT_EVT_DATA_RECEIVED\n&amp;quot;);
		print_received_data(evt-&amp;gt;data.msg.ptr, evt-&amp;gt;data.msg.topic.str,
				    evt-&amp;gt;data.msg.topic.len);
		break;
	case AWS_IOT_EVT_FOTA_START:
		printk(&amp;quot;AWS_IOT_EVT_FOTA_START\n&amp;quot;);
		break;
	case AWS_IOT_EVT_FOTA_ERASE_PENDING:
		printk(&amp;quot;AWS_IOT_EVT_FOTA_ERASE_PENDING\n&amp;quot;);
		printk(&amp;quot;Disconnect LTE link or reboot\n&amp;quot;);
#if defined(CONFIG_BSD_LIBRARY)
		err = lte_lc_offline();
		if (err) {
			printk(&amp;quot;Error disconnecting from LTE\n&amp;quot;);
		}
#endif
		break;
	case AWS_IOT_EVT_FOTA_ERASE_DONE:
		printk(&amp;quot;AWS_FOTA_EVT_ERASE_DONE\n&amp;quot;);
		printk(&amp;quot;Reconnecting the LTE link&amp;quot;);
#if defined(CONFIG_BSD_LIBRARY)
		err = lte_lc_connect();
		if (err) {
			printk(&amp;quot;Error connecting to LTE\n&amp;quot;);
		}
#endif
		break;
	case AWS_IOT_EVT_FOTA_DONE:
		printk(&amp;quot;AWS_IOT_EVT_FOTA_DONE\n&amp;quot;);
		printk(&amp;quot;FOTA done, rebooting device\n&amp;quot;);
		aws_iot_disconnect();
		sys_reboot(0);
		break;
	case AWS_IOT_EVT_FOTA_DL_PROGRESS:
		printk(&amp;quot;AWS_IOT_EVT_FOTA_DL_PROGRESS, (%d%%)&amp;quot;,
		       evt-&amp;gt;data.fota_progress);
	case AWS_IOT_EVT_ERROR:
		printk(&amp;quot;AWS_IOT_EVT_ERROR, %d\n&amp;quot;, evt-&amp;gt;data.err);
		break;
	default:
		printk(&amp;quot;Unknown AWS IoT event type: %d\n&amp;quot;, evt-&amp;gt;type);
		break;
	}
}

static void work_init(void)
{
	k_delayed_work_init(&amp;amp;shadow_update_work, shadow_update_work_fn);
	k_delayed_work_init(&amp;amp;connect_work, connect_work_fn);
	k_delayed_work_init(&amp;amp;shadow_update_version_work,
			    shadow_update_version_work_fn);
}

#if defined(CONFIG_BSD_LIBRARY)
static void lte_handler(const struct lte_lc_evt *const evt)
{
	switch (evt-&amp;gt;type) {
	case LTE_LC_EVT_NW_REG_STATUS:
		if ((evt-&amp;gt;nw_reg_status != LTE_LC_NW_REG_REGISTERED_HOME) &amp;amp;&amp;amp;
		     (evt-&amp;gt;nw_reg_status != LTE_LC_NW_REG_REGISTERED_ROAMING)) {
			break;
		}

		printk(&amp;quot;Network registration status: %s\n&amp;quot;,
			evt-&amp;gt;nw_reg_status == LTE_LC_NW_REG_REGISTERED_HOME ?
			&amp;quot;Connected - home network&amp;quot; : &amp;quot;Connected - roaming&amp;quot;);

		k_sem_give(&amp;amp;lte_connected);
		break;
	case LTE_LC_EVT_PSM_UPDATE:
		printk(&amp;quot;PSM parameter update: TAU: %d, Active time: %d\n&amp;quot;,
			evt-&amp;gt;psm_cfg.tau, evt-&amp;gt;psm_cfg.active_time);
		break;
	case LTE_LC_EVT_EDRX_UPDATE: {
		char log_buf[60];
		ssize_t len;

		len = snprintf(log_buf, sizeof(log_buf),
			       &amp;quot;eDRX parameter update: eDRX: %f, PTW: %f&amp;quot;,
			       evt-&amp;gt;edrx_cfg.edrx, evt-&amp;gt;edrx_cfg.ptw);
		if (len &amp;gt; 0) {
			printk(&amp;quot;%s\n&amp;quot;, log_buf);
		}
		break;
	}
	case LTE_LC_EVT_RRC_UPDATE:
		printk(&amp;quot;RRC mode: %s\n&amp;quot;,
			evt-&amp;gt;rrc_mode == LTE_LC_RRC_MODE_CONNECTED ?
			&amp;quot;Connected&amp;quot; : &amp;quot;Idle&amp;quot;);
		break;
	case LTE_LC_EVT_CELL_UPDATE:
		printk(&amp;quot;LTE cell changed: Cell ID: %d, Tracking area: %d\n&amp;quot;,
			evt-&amp;gt;cell.id, evt-&amp;gt;cell.tac);
		break;
	default:
		break;
	}
}

static void modem_configure(void)
{
	int err;
	
#if defined(CONFIG_BSD_LIBRARY)

	if (IS_ENABLED(CONFIG_LTE_AUTO_INIT_AND_CONNECT)) {
		/* Do nothing, modem is already configured and LTE connected. */
	} else{
		err = lte_lc_init_and_connect_async(lte_handler);
		if (err) {
			printk(&amp;quot;Modem could not be configured, error: %d\n&amp;quot;,
				err);
			return;
		}
	}
		err = modem_info_init();
	if (err) {
		printk(&amp;quot;Failed initializing modem info module, error: %d\n&amp;quot;,
			err);
	}
	k_sem_take(&amp;amp;lte_connected, K_FOREVER);
#endif	
}

static void at_configure(void)
{
	int err;

	err = at_notif_init();
	__ASSERT(err == 0, &amp;quot;AT Notify could not be initialized.&amp;quot;);
	err = at_cmd_init();
	__ASSERT(err == 0, &amp;quot;AT CMD could not be established.&amp;quot;);
}

static void bsd_lib_modem_dfu_handler(void)
{
	int err;

	err = bsdlib_init();

	switch (err) {
	case MODEM_DFU_RESULT_OK:
		printk(&amp;quot;Modem update suceeded, reboot\n&amp;quot;);
		sys_reboot(SYS_REBOOT_COLD);
		break;
	case MODEM_DFU_RESULT_UUID_ERROR:
	case MODEM_DFU_RESULT_AUTH_ERROR:
		printk(&amp;quot;Modem update failed, error: %d\n&amp;quot;, err);
		printk(&amp;quot;Modem will use old firmware\n&amp;quot;);
		sys_reboot(SYS_REBOOT_COLD);
		break;
	case MODEM_DFU_RESULT_HARDWARE_ERROR:
	case MODEM_DFU_RESULT_INTERNAL_ERROR:
		printk(&amp;quot;Modem update malfunction, error: %d, reboot\n&amp;quot;, err);
		sys_reboot(SYS_REBOOT_COLD);
		break;
	default:
		break;
	}

	at_configure();
}
#endif

static int app_topics_subscribe(void)
{
	int err;
	static char custom_topic[75] = &amp;quot;$aws/things/nrf-352656101080789/shadow/update&amp;quot;;
	static char custom_topic_2[75] = &amp;quot;$aws/things/nrf-352656101080789/shadow/delta&amp;quot;;

	const struct aws_iot_topic_data topics_list[APP_TOPICS_COUNT] = {
		[0].str = custom_topic,
		[0].len = strlen(custom_topic),
		[1].str = custom_topic_2,
		[1].len = strlen(custom_topic_2)
	};

	err = aws_iot_subscription_topics_add(topics_list,
					      ARRAY_SIZE(topics_list));
	if (err) {
		printk(&amp;quot;aws_iot_subscription_topics_add, error: %d\n&amp;quot;, err);
	}

	return err;
}

static void date_time_event_handler(const struct date_time_evt *evt)
{
	switch (evt-&amp;gt;type) {
	case DATE_TIME_OBTAINED_MODEM:
		printk(&amp;quot;DATE_TIME_OBTAINED_MODEM\n&amp;quot;);
		break;
	case DATE_TIME_OBTAINED_NTP:
		printk(&amp;quot;DATE_TIME_OBTAINED_NTP\n&amp;quot;);
		break;
	case DATE_TIME_OBTAINED_EXT:
		printk(&amp;quot;DATE_TIME_OBTAINED_EXT\n&amp;quot;);
		break;
	case DATE_TIME_NOT_OBTAINED:
		printk(&amp;quot;DATE_TIME_NOT_OBTAINED\n&amp;quot;);
		break;
	default:
		break;
	}

	/** Do not depend on obtained time, continue upon any event from the
	 *  date time library.
	 */
	k_sem_give(&amp;amp;date_time_obtained);
}

// int main(void)
// {
	// nrf_gnss_data_frame_t gps_data;
	// uint8_t		      cnt = 0;

// #ifdef CONFIG_SUPL_CLIENT_LIB
	// static struct supl_api supl_api = {
		// .read       = supl_read,
		// .write      = supl_write,
		// .handler    = inject_agps_type,
		// .logger     = supl_logger,
		// .counter_ms = k_uptime_get
	// };
// #endif

	// printk(&amp;quot;Starting GPS application\n&amp;quot;);

	// if (init_app() != 0) {
		// return -1;
	// }

// #ifdef CONFIG_SUPL_CLIENT_LIB
	// int rc = supl_init(&amp;amp;supl_api);

	// if (rc != 0) {
		// return rc;
	// }
// #endif

	// printk(&amp;quot;Getting GPS data...\n&amp;quot;);

	// while (1) {

		// do {
			// /* Loop until we don&amp;#39;t have more
			 // * data to read
			 // */
		// } while (process_gps_data(&amp;amp;gps_data) &amp;gt; 0);

		// if (IS_ENABLED(CONFIG_GPS_SAMPLE_NMEA_ONLY)) {
			// print_nmea_data();
			// nmea_string_cnt = 0;
		// } else {
			// printk(&amp;quot;\033[1;1H&amp;quot;);
			// printk(&amp;quot;\033[2J&amp;quot;);
			// print_satellite_stats(&amp;amp;last_pvt);
			// print_gnss_stats(&amp;amp;last_pvt);
			// printk(&amp;quot;---------------------------------\n&amp;quot;);

			// if (!got_fix) {
				// printk(&amp;quot;Seconds since last fix: %lld\n&amp;quot;,
				       // (k_uptime_get() - fix_timestamp) / 1000);
				// cnt++;
				// printk(&amp;quot;Searching [%c]\n&amp;quot;,
				       // update_indicator[cnt%4]);
			// } else {
				// print_fix_data(&amp;amp;last_pvt);
			// }

			// printk(&amp;quot;\nNMEA strings:\n\n&amp;quot;);
			// print_nmea_data();
			// printk(&amp;quot;---------------------------------&amp;quot;);
		// }

		// k_sleep(K_MSEC(500));
	// }

	// return 0;
// }


int main(void)
{
	nrf_gnss_data_frame_t gps_data;
	uint8_t		      cnt = 0;
	int err;
	
	printk(&amp;quot;The AWS IoT sample started, version: %s\n&amp;quot;, CONFIG_APP_VERSION);

	cJSON_Init();
	
#if defined(CONFIG_BSD_LIBRARY)
	bsd_lib_modem_dfu_handler();
#endif
	
#ifdef CONFIG_SUPL_CLIENT_LIB
	static struct supl_api supl_api = {
		.read       = supl_read,
		.write      = supl_write,
		.handler    = inject_agps_type,
		.logger     = supl_logger,
		.counter_ms = k_uptime_get
	};
#endif

	err = aws_iot_init(NULL, aws_iot_event_handler);
	if (err) {
		printk(&amp;quot;AWS IoT library could not be initialized, error: %d\n&amp;quot;,
		       err);
	}

	/** Subscribe to customizable non-shadow specific topics
	 *  to AWS IoT backend.
	 */
	err = app_topics_subscribe();
	if (err) {
		printk(&amp;quot;Adding application specific topics failed, error: %d\n&amp;quot;,
			err);
	}

	work_init();
		
	printk(&amp;quot;Starting GPS application\n&amp;quot;);
	
	modem_configure();
		
	if (init_app() != 0) {
		//return -1;
		printk(&amp;quot;error in init app\n&amp;quot;);
	}

	
#ifdef CONFIG_SUPL_CLIENT_LIB
	int rc = supl_init(&amp;amp;supl_api);

	if (rc != 0) {
		return rc;
	}
#endif


	date_time_update_async(date_time_event_handler);

	err = k_sem_take(&amp;amp;date_time_obtained, K_SECONDS(DATE_TIME_TIMEOUT_S));
	if (err) {
		printk(&amp;quot;Date time, no callback event within %d seconds\n&amp;quot;,
			DATE_TIME_TIMEOUT_S);
	}

	k_delayed_work_submit(&amp;amp;connect_work, K_NO_WAIT);
	
	printk(&amp;quot;Getting GPS data...\n&amp;quot;);

	while (1) {

		do {
			/* Loop until we don&amp;#39;t have more
			 * data to read
			 */
		} while (process_gps_data(&amp;amp;gps_data) &amp;gt; 0);

		if (IS_ENABLED(CONFIG_GPS_SAMPLE_NMEA_ONLY)) {
			print_nmea_data();
			nmea_string_cnt = 0;
		} else {
			printk(&amp;quot;\033[1;1H&amp;quot;);
			printk(&amp;quot;\033[2J&amp;quot;);
			print_satellite_stats(&amp;amp;last_pvt);
			print_gnss_stats(&amp;amp;last_pvt);
			printk(&amp;quot;---------------------------------\n&amp;quot;);

			if (!got_fix) {
				printk(&amp;quot;Seconds since last fix: %lld\n&amp;quot;,
				       (k_uptime_get() - fix_timestamp) / 1000);
				cnt++;
				printk(&amp;quot;Searching [%c]\n&amp;quot;,
				       update_indicator[cnt%4]);
			} else {
				print_fix_data(&amp;amp;last_pvt);
			}

			printk(&amp;quot;\nNMEA strings:\n\n&amp;quot;);
			print_nmea_data();
			printk(&amp;quot;---------------------------------&amp;quot;);
		}

		k_sleep(K_MSEC(500));
	}

	return 0;
}
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;2021-01-07T10:28:09.398Z INFO Application data folder: C:\Users\rahul\AppData\Roaming\nrfconnect\pc-nrfconnect-linkmonitor
2021-01-07T10:28:09.421Z DEBUG App pc-nrfconnect-linkmonitor v1.1.10 official
2021-01-07T10:28:09.421Z DEBUG App path: C:\Users\rahul\.nrfconnect-apps\node_modules\pc-nrfconnect-linkmonitor
2021-01-07T10:28:09.421Z DEBUG nRFConnect 3.6.1 is supported by the app (^3.6.0)
2021-01-07T10:28:09.421Z DEBUG nRFConnect path: C:\Users\rahul\AppData\Local\Programs\nrfconnect\resources\app.asar
2021-01-07T10:28:09.421Z DEBUG HomeDir: C:\Users\rahul
2021-01-07T10:28:09.421Z DEBUG TmpDir: C:\Users\rahul\AppData\Local\Temp
2021-01-07T10:28:12.670Z INFO Modem port is opened
2021-01-07T10:28:12.676Z DEBUG modem &amp;gt;&amp;gt; AT+CFUN?
2021-01-07T10:28:12.873Z DEBUG modem &amp;lt;&amp;lt; *** Booting Zephyr OS build v2.4.0-ncs1-1710-g5a7b4eb71047  ***
2021-01-07T10:28:12.887Z DEBUG modem &amp;lt;&amp;lt; 
2021-01-07T10:28:12.889Z DEBUG modem &amp;lt;&amp;lt; I: UART check failed: 1. Dropping buffer and retrying.
2021-01-07T10:28:12.918Z DEBUG modem &amp;lt;&amp;lt; The AWS IoT sample started, version: v1.0.0
2021-01-07T10:28:12.920Z DEBUG modem &amp;lt;&amp;lt; W: Already initialized. Nothing to do
2021-01-07T10:28:12.921Z DEBUG modem &amp;lt;&amp;lt; Starting GPS application
2021-01-07T10:28:14.542Z DEBUG modem &amp;lt;&amp;lt; +CEREG: 2,&amp;quot;8402&amp;quot;,&amp;quot;02055C03&amp;quot;,7,0,0,&amp;quot;11100000&amp;quot;,&amp;quot;11100000&amp;quot;
2021-01-07T10:28:14.546Z DEBUG modem &amp;lt;&amp;lt; LTE cell changed: Cell ID: 33905667, Tracking area: 33794
2021-01-07T10:28:14.547Z DEBUG modem &amp;lt;&amp;lt; PSM parameter update: TAU: -1, Active time: -1
2021-01-07T10:28:14.695Z DEBUG modem &amp;lt;&amp;lt; +CSCON: 1
2021-01-07T10:28:14.698Z DEBUG modem &amp;lt;&amp;lt; RRC mode: Connected
2021-01-07T10:28:15.837Z DEBUG modem &amp;lt;&amp;lt; +CEREG: 5,&amp;quot;8402&amp;quot;,&amp;quot;02055C03&amp;quot;,7,,,&amp;quot;11100000&amp;quot;,&amp;quot;11100000&amp;quot;
2021-01-07T10:28:15.841Z DEBUG modem &amp;lt;&amp;lt; Network registration status: Connected - roaming
2021-01-07T10:28:15.843Z DEBUG modem &amp;lt;&amp;lt; Failed to initialize modem
2021-01-07T10:28:15.844Z DEBUG modem &amp;lt;&amp;lt; error in init app
2021-01-07T10:28:16.720Z DEBUG modem &amp;lt;&amp;lt; DATE_TIME_OBTAINED_NTP
2021-01-07T10:28:16.721Z DEBUG modem &amp;lt;&amp;lt; Next connection retry in 20 seconds
2021-01-07T10:28:16.725Z DEBUG modem &amp;lt;&amp;lt; Getting GPS data...
2021-01-07T10:28:16.727Z DEBUG modem &amp;lt;&amp;lt; [1;1H[2JTracking: 0 Using: 0 Unhealthy: 0
2021-01-07T10:28:16.728Z DEBUG modem &amp;lt;&amp;lt; ---------------------------------
2021-01-07T10:28:16.729Z DEBUG modem &amp;lt;&amp;lt; Seconds since last fix: 4
2021-01-07T10:28:16.729Z DEBUG modem &amp;lt;&amp;lt; Searching [|]
2021-01-07T10:28:16.731Z DEBUG modem &amp;lt;&amp;lt; NMEA strings:
2021-01-07T10:28:16.732Z DEBUG modem &amp;lt;&amp;lt; ---------------------------------AWS_IOT_EVT_CONNECTING
2021-01-07T10:28:17.233Z DEBUG modem &amp;lt;&amp;lt; [1;1H[2JTracking: 0 Using: 0 Unhealthy: 0
2021-01-07T10:28:17.237Z DEBUG modem &amp;lt;&amp;lt; ---------------------------------
2021-01-07T10:28:17.238Z DEBUG modem &amp;lt;&amp;lt; Seconds since last fix: 4
2021-01-07T10:28:17.239Z DEBUG modem &amp;lt;&amp;lt; Searching [/]
2021-01-07T10:28:17.240Z DEBUG modem &amp;lt;&amp;lt; NMEA strings:
2021-01-07T10:28:17.748Z DEBUG modem &amp;lt;&amp;lt; ---------------------------------[1;1H[2JTracking: 0 Using: 0 Unhealthy: 0
2021-01-07T10:28:17.750Z DEBUG modem &amp;lt;&amp;lt; ---------------------------------
2021-01-07T10:28:17.751Z DEBUG modem &amp;lt;&amp;lt; Seconds since last fix: 5
2021-01-07T10:28:17.752Z DEBUG modem &amp;lt;&amp;lt; Searching [-]
2021-01-07T10:28:17.753Z DEBUG modem &amp;lt;&amp;lt; NMEA strings:
2021-01-07T10:28:18.263Z DEBUG modem &amp;lt;&amp;lt; ---------------------------------[1;1H[2JTracking: 0 Using: 0 Unhealthy: 0
2021-01-07T10:28:18.265Z DEBUG modem &amp;lt;&amp;lt; ---------------------------------
2021-01-07T10:28:18.268Z DEBUG modem &amp;lt;&amp;lt; Seconds since last fix: 5
2021-01-07T10:28:18.269Z DEBUG modem &amp;lt;&amp;lt; Searching [\]
2021-01-07T10:28:18.270Z DEBUG modem &amp;lt;&amp;lt; NMEA strings:
2021-01-07T10:28:18.777Z DEBUG modem &amp;lt;&amp;lt; ---------------------------------[1;1H[2JTracking: 0 Using: 0 Unhealthy: 0
2021-01-07T10:28:18.779Z DEBUG modem &amp;lt;&amp;lt; ---------------------------------
2021-01-07T10:28:18.780Z DEBUG modem &amp;lt;&amp;lt; Seconds since last fix: 6
2021-01-07T10:28:18.781Z DEBUG modem &amp;lt;&amp;lt; Searching [|]
2021-01-07T10:28:18.782Z DEBUG modem &amp;lt;&amp;lt; NMEA strings:
2021-01-07T10:28:19.293Z DEBUG modem &amp;lt;&amp;lt; ---------------------------------[1;1H[2JTracking: 0 Using: 0 Unhealthy: 0
2021-01-07T10:28:19.298Z DEBUG modem &amp;lt;&amp;lt; ---------------------------------
2021-01-07T10:28:19.299Z DEBUG modem &amp;lt;&amp;lt; Seconds since last fix: 6
2021-01-07T10:28:19.300Z DEBUG modem &amp;lt;&amp;lt; Searching [/]
2021-01-07T10:28:19.301Z DEBUG modem &amp;lt;&amp;lt; NMEA strings:
2021-01-07T10:28:19.808Z DEBUG modem &amp;lt;&amp;lt; ---------------------------------[1;1H[2JTracking: 0 Using: 0 Unhealthy: 0
2021-01-07T10:28:19.814Z DEBUG modem &amp;lt;&amp;lt; ---------------------------------
2021-01-07T10:28:19.815Z DEBUG modem &amp;lt;&amp;lt; Seconds since last fix: 7
2021-01-07T10:28:19.816Z DEBUG modem &amp;lt;&amp;lt; Searching [-]
2021-01-07T10:28:19.817Z DEBUG modem &amp;lt;&amp;lt; NMEA strings:
2021-01-07T10:28:20.319Z DEBUG modem &amp;lt;&amp;lt; ---------------------------------[1;1H[2JTracking: 0 Using: 0 Unhealthy: 0
2021-01-07T10:28:20.320Z DEBUG modem &amp;lt;&amp;lt; ---------------------------------
2021-01-07T10:28:20.321Z DEBUG modem &amp;lt;&amp;lt; Seconds since last fix: 7
2021-01-07T10:28:20.321Z DEBUG modem &amp;lt;&amp;lt; Searching [\]
2021-01-07T10:28:20.322Z DEBUG modem &amp;lt;&amp;lt; NMEA strings:
2021-01-07T10:28:20.837Z DEBUG modem &amp;lt;&amp;lt; ---------------------------------[1;1H[2JTracking: 0 Using: 0 Unhealthy: 0
2021-01-07T10:28:20.842Z DEBUG modem &amp;lt;&amp;lt; ---------------------------------
2021-01-07T10:28:20.843Z DEBUG modem &amp;lt;&amp;lt; Seconds since last fix: 8
2021-01-07T10:28:20.843Z DEBUG modem &amp;lt;&amp;lt; Searching [|]
2021-01-07T10:28:20.844Z DEBUG modem &amp;lt;&amp;lt; NMEA strings:
2021-01-07T10:28:21.353Z DEBUG modem &amp;lt;&amp;lt; ---------------------------------[1;1H[2JTracking: 0 Using: 0 Unhealthy: 0
2021-01-07T10:28:21.357Z DEBUG modem &amp;lt;&amp;lt; ---------------------------------
2021-01-07T10:28:21.358Z DEBUG modem &amp;lt;&amp;lt; Seconds since last fix: 8
2021-01-07T10:28:21.358Z DEBUG modem &amp;lt;&amp;lt; Searching [/]
2021-01-07T10:28:21.359Z DEBUG modem &amp;lt;&amp;lt; NMEA strings:
2021-01-07T10:28:21.868Z DEBUG modem &amp;lt;&amp;lt; ---------------------------------[1;1H[2JTracking: 0 Using: 0 Unhealthy: 0
2021-01-07T10:28:21.869Z DEBUG modem &amp;lt;&amp;lt; ---------------------------------
2021-01-07T10:28:21.870Z DEBUG modem &amp;lt;&amp;lt; Seconds since last fix: 9
2021-01-07T10:28:21.871Z DEBUG modem &amp;lt;&amp;lt; Searching [-]
2021-01-07T10:28:21.871Z DEBUG modem &amp;lt;&amp;lt; NMEA strings:
2021-01-07T10:28:22.382Z DEBUG modem &amp;lt;&amp;lt; ---------------------------------[1;1H[2JTracking: 0 Using: 0 Unhealthy: 0
2021-01-07T10:28:22.388Z DEBUG modem &amp;lt;&amp;lt; ---------------------------------
2021-01-07T10:28:22.389Z DEBUG modem &amp;lt;&amp;lt; Seconds since last fix: 9
2021-01-07T10:28:22.390Z DEBUG modem &amp;lt;&amp;lt; Searching [\]
2021-01-07T10:28:22.391Z DEBUG modem &amp;lt;&amp;lt; NMEA strings:
2021-01-07T10:28:22.898Z DEBUG modem &amp;lt;&amp;lt; ---------------------------------[1;1H[2JTracking: 0 Using: 0 Unhealthy: 0
2021-01-07T10:28:22.915Z DEBUG modem &amp;lt;&amp;lt; ---------------------------------
2021-01-07T10:28:22.918Z DEBUG modem &amp;lt;&amp;lt; Seconds since last fix: 10
2021-01-07T10:28:22.921Z DEBUG modem &amp;lt;&amp;lt; Searching [|]
2021-01-07T10:28:22.925Z DEBUG modem &amp;lt;&amp;lt; NMEA strings:
2021-01-07T10:28:23.412Z DEBUG modem &amp;lt;&amp;lt; ---------------------------------[1;1H[2JTracking: 0 Using: 0 Unhealthy: 0
2021-01-07T10:28:23.418Z DEBUG modem &amp;lt;&amp;lt; ---------------------------------
2021-01-07T10:28:23.419Z DEBUG modem &amp;lt;&amp;lt; Seconds since last fix: 10
2021-01-07T10:28:23.420Z DEBUG modem &amp;lt;&amp;lt; Searching [/]
2021-01-07T10:28:23.421Z DEBUG modem &amp;lt;&amp;lt; NMEA strings:
2021-01-07T10:28:23.929Z DEBUG modem &amp;lt;&amp;lt; ---------------------------------[1;1H[2JTracking: 0 Using: 0 Unhealthy: 0
2021-01-07T10:28:23.940Z DEBUG modem &amp;lt;&amp;lt; ---------------------------------
2021-01-07T10:28:23.941Z DEBUG modem &amp;lt;&amp;lt; Seconds since last fix: 11
2021-01-07T10:28:23.941Z DEBUG modem &amp;lt;&amp;lt; Searching [-]
2021-01-07T10:28:23.942Z DEBUG modem &amp;lt;&amp;lt; NMEA strings:
2021-01-07T10:28:24.443Z DEBUG modem &amp;lt;&amp;lt; ---------------------------------[1;1H[2JTracking: 0 Using: 0 Unhealthy: 0
2021-01-07T10:28:24.454Z DEBUG modem &amp;lt;&amp;lt; ---------------------------------
2021-01-07T10:28:24.455Z DEBUG modem &amp;lt;&amp;lt; Seconds since last fix: 11
2021-01-07T10:28:24.456Z DEBUG modem &amp;lt;&amp;lt; Searching [\]
2021-01-07T10:28:24.457Z DEBUG modem &amp;lt;&amp;lt; NMEA strings:
2021-01-07T10:28:24.959Z DEBUG modem &amp;lt;&amp;lt; ---------------------------------[1;1H[2JTracking: 0 Using: 0 Unhealthy: 0
2021-01-07T10:28:24.970Z DEBUG modem &amp;lt;&amp;lt; ---------------------------------
2021-01-07T10:28:24.971Z DEBUG modem &amp;lt;&amp;lt; Seconds since last fix: 12
2021-01-07T10:28:24.972Z DEBUG modem &amp;lt;&amp;lt; Searching [|]
2021-01-07T10:28:24.973Z DEBUG modem &amp;lt;&amp;lt; NMEA strings:
2021-01-07T10:28:25.239Z DEBUG modem &amp;lt;&amp;lt; ---------------------------------AWS_IOT_EVT_CONNECTED
2021-01-07T10:28:25.242Z DEBUG modem &amp;lt;&amp;lt; Persistent session enabled
2021-01-07T10:28:25.253Z DEBUG modem &amp;lt;&amp;lt; Publishing: {
2021-01-07T10:28:25.255Z DEBUG modem &amp;lt;&amp;lt; &amp;quot;state&amp;quot;:{
2021-01-07T10:28:25.257Z DEBUG modem &amp;lt;&amp;lt; &amp;quot;reported&amp;quot;:{
2021-01-07T10:28:25.265Z DEBUG modem &amp;lt;&amp;lt; &amp;quot;app_version&amp;quot;:&amp;quot;v1.0.0&amp;quot;,
2021-01-07T10:28:25.267Z DEBUG modem &amp;lt;&amp;lt; &amp;quot;batv&amp;quot;:4406,
2021-01-07T10:28:25.268Z DEBUG modem &amp;lt;&amp;lt; &amp;quot;ts&amp;quot;:1610015304543
2021-01-07T10:28:25.269Z DEBUG modem &amp;lt;&amp;lt; }
2021-01-07T10:28:25.270Z DEBUG modem &amp;lt;&amp;lt; }
2021-01-07T10:28:25.271Z DEBUG modem &amp;lt;&amp;lt; } to AWS IoT broker
2021-01-07T10:28:25.272Z DEBUG modem &amp;lt;&amp;lt; AWS_IOT_EVT_READY
2021-01-07T10:28:25.473Z DEBUG modem &amp;lt;&amp;lt; [1;1H[2JTracking: 0 Using: 0 Unhealthy: 0
2021-01-07T10:28:25.478Z DEBUG modem &amp;lt;&amp;lt; ---------------------------------
2021-01-07T10:28:25.479Z DEBUG modem &amp;lt;&amp;lt; Seconds since last fix: 12
2021-01-07T10:28:25.480Z DEBUG modem &amp;lt;&amp;lt; Searching [/]
2021-01-07T10:28:25.483Z DEBUG modem &amp;lt;&amp;lt; NMEA strings:
2021-01-07T10:28:25.722Z DEBUG modem &amp;lt;&amp;lt; ---------------------------------AWS_IOT_EVT_DATA_RECEIVED
2021-01-07T10:28:25.740Z DEBUG modem &amp;lt;&amp;lt; Data received from AWS IoT console:
2021-01-07T10:28:25.741Z DEBUG modem &amp;lt;&amp;lt; Topic: $aws/things/nrf-352656101080789/shadow/update
2021-01-07T10:28:25.746Z DEBUG modem &amp;lt;&amp;lt; Message: {
2021-01-07T10:28:25.747Z DEBUG modem &amp;lt;&amp;lt; &amp;quot;state&amp;quot;:{
2021-01-07T10:28:25.747Z DEBUG modem &amp;lt;&amp;lt; &amp;quot;reported&amp;quot;:{
2021-01-07T10:28:25.748Z DEBUG modem &amp;lt;&amp;lt; &amp;quot;app_version&amp;quot;:&amp;quot;v1.0.0&amp;quot;,
2021-01-07T10:28:25.748Z DEBUG modem &amp;lt;&amp;lt; &amp;quot;batv&amp;quot;:4406,
2021-01-07T10:28:25.749Z DEBUG modem &amp;lt;&amp;lt; &amp;quot;ts&amp;quot;:1610015304543
2021-01-07T10:28:25.749Z DEBUG modem &amp;lt;&amp;lt; }
2021-01-07T10:28:25.750Z DEBUG modem &amp;lt;&amp;lt; }
2021-01-07T10:28:25.750Z DEBUG modem &amp;lt;&amp;lt; }
2021-01-07T10:28:25.871Z DEBUG modem &amp;lt;&amp;lt; AWS_IOT_EVT_DATA_RECEIVED
2021-01-07T10:28:25.944Z DEBUG modem &amp;lt;&amp;lt; Data received from AWS IoT console:
2021-01-07T10:28:25.946Z DEBUG modem &amp;lt;&amp;lt; Topic: $aws/things/nrf-352656101080789/shadow/get/accepted
2021-01-07T10:28:25.947Z DEBUG modem &amp;lt;&amp;lt; Message: {
2021-01-07T10:28:25.947Z DEBUG modem &amp;lt;&amp;lt; &amp;quot;state&amp;quot;:{
2021-01-07T10:28:25.948Z DEBUG modem &amp;lt;&amp;lt; &amp;quot;desired&amp;quot;:{
2021-01-07T10:28:25.948Z DEBUG modem &amp;lt;&amp;lt; &amp;quot;welcome&amp;quot;:&amp;quot;Vikas&amp;quot;
2021-01-07T10:28:25.949Z DEBUG modem &amp;lt;&amp;lt; },
2021-01-07T10:28:25.949Z DEBUG modem &amp;lt;&amp;lt; &amp;quot;reported&amp;quot;:{
2021-01-07T10:28:25.949Z DEBUG modem &amp;lt;&amp;lt; &amp;quot;welcome&amp;quot;:&amp;quot;Dark Horse&amp;quot;,
2021-01-07T10:28:25.950Z DEBUG modem &amp;lt;&amp;lt; &amp;quot;app_version&amp;quot;:&amp;quot;v1.0.0&amp;quot;,
2021-01-07T10:28:25.951Z DEBUG modem &amp;lt;&amp;lt; &amp;quot;batv&amp;quot;:4406,
2021-01-07T10:28:25.951Z DEBUG modem &amp;lt;&amp;lt; &amp;quot;ts&amp;quot;:943920003687
2021-01-07T10:28:25.952Z DEBUG modem &amp;lt;&amp;lt; },
2021-01-07T10:28:25.952Z DEBUG modem &amp;lt;&amp;lt; &amp;quot;delta&amp;quot;:{
2021-01-07T10:28:25.952Z DEBUG modem &amp;lt;&amp;lt; &amp;quot;welcome&amp;quot;:&amp;quot;Vikas&amp;quot;
2021-01-07T10:28:25.953Z DEBUG modem &amp;lt;&amp;lt; }
2021-01-07T10:28:25.953Z DEBUG modem &amp;lt;&amp;lt; },
2021-01-07T10:28:25.954Z DEBUG modem &amp;lt;&amp;lt; &amp;quot;metadata&amp;quot;:{
2021-01-07T10:28:25.961Z DEBUG modem &amp;lt;&amp;lt; &amp;quot;desired&amp;quot;:{
2021-01-07T10:28:25.962Z DEBUG modem &amp;lt;&amp;lt; &amp;quot;welcome&amp;quot;:{
2021-01-07T10:28:25.962Z DEBUG modem &amp;lt;&amp;lt; &amp;quot;timestamp&amp;quot;:1608869909
2021-01-07T10:28:25.963Z DEBUG modem &amp;lt;&amp;lt; }
2021-01-07T10:28:25.963Z DEBUG modem &amp;lt;&amp;lt; },
2021-01-07T10:28:25.964Z DEBUG modem &amp;lt;&amp;lt; &amp;quot;reported&amp;quot;:{
2021-01-07T10:28:25.964Z DEBUG modem &amp;lt;&amp;lt; &amp;quot;welcome&amp;quot;:{
2021-01-07T10:28:25.964Z DEBUG modem &amp;lt;&amp;lt; &amp;quot;timestamp&amp;quot;:1608869909
2021-01-07T10:28:25.965Z DEBUG modem &amp;lt;&amp;lt; },
2021-01-07T10:28:25.965Z DEBUG modem &amp;lt;&amp;lt; &amp;quot;app_version&amp;quot;:{
2021-01-07T10:28:25.966Z DEBUG modem &amp;lt;&amp;lt; &amp;quot;timestamp&amp;quot;:1610013963
2021-01-07T10:28:25.966Z DEBUG modem &amp;lt;&amp;lt; },
2021-01-07T10:28:25.966Z DEBUG modem &amp;lt;&amp;lt; &amp;quot;batv&amp;quot;:{
2021-01-07T10:28:25.967Z DEBUG modem &amp;lt;&amp;lt; &amp;quot;timestamp&amp;quot;:1610013963
2021-01-07T10:28:25.967Z DEBUG modem &amp;lt;&amp;lt; },
2021-01-07T10:28:25.968Z DEBUG modem &amp;lt;&amp;lt; &amp;quot;ts&amp;quot;:{
2021-01-07T10:28:25.968Z DEBUG modem &amp;lt;&amp;lt; &amp;quot;timestamp&amp;quot;:1610013963
2021-01-07T10:28:25.969Z DEBUG modem &amp;lt;&amp;lt; }
2021-01-07T10:28:25.969Z DEBUG modem &amp;lt;&amp;lt; }
2021-01-07T10:28:25.970Z DEBUG modem &amp;lt;&amp;lt; },
2021-01-07T10:28:25.971Z DEBUG modem &amp;lt;&amp;lt; &amp;quot;version&amp;quot;:3203,
2021-01-07T10:28:25.971Z DEBUG modem &amp;lt;&amp;lt; &amp;quot;timestamp&amp;quot;:1610015305
2021-01-07T10:28:25.972Z DEBUG modem &amp;lt;&amp;lt; }
2021-01-07T10:28:25.973Z DEBUG modem &amp;lt;&amp;lt; AWS_IOT_EVT_DATA_RECEIVED
2021-01-07T10:28:25.993Z DEBUG modem &amp;lt;&amp;lt; Data received from AWS IoT console:
2021-01-07T10:28:25.994Z DEBUG modem &amp;lt;&amp;lt; Topic: $aws/things/nrf-352656101080789/shadow/update/delta
2021-01-07T10:28:25.995Z DEBUG modem &amp;lt;&amp;lt; Message: {
2021-01-07T10:28:25.996Z DEBUG modem &amp;lt;&amp;lt; &amp;quot;version&amp;quot;:3204,
2021-01-07T10:28:25.997Z DEBUG modem &amp;lt;&amp;lt; &amp;quot;timestamp&amp;quot;:1610015305,
2021-01-07T10:28:25.998Z DEBUG modem &amp;lt;&amp;lt; &amp;quot;state&amp;quot;:{
2021-01-07T10:28:25.999Z DEBUG modem &amp;lt;&amp;lt; &amp;quot;welcome&amp;quot;:&amp;quot;Vikas&amp;quot;
2021-01-07T10:28:25.999Z DEBUG modem &amp;lt;&amp;lt; },
2021-01-07T10:28:25.999Z DEBUG modem &amp;lt;&amp;lt; &amp;quot;metadata&amp;quot;:{
2021-01-07T10:28:26.006Z DEBUG modem &amp;lt;&amp;lt; &amp;quot;w[1;1H[2JTracking: 0 Using: 0 Unhealthy: 0---------------------------------Seconds since last fix: 13Searching [-]NMEA strings:---------------------------------elcome&amp;quot;:{
2021-01-07T10:28:26.007Z DEBUG modem &amp;lt;&amp;lt; &amp;quot;timestamp&amp;quot;:1608869909
2021-01-07T10:28:26.008Z DEBUG modem &amp;lt;&amp;lt; }
2021-01-07T10:28:26.008Z DEBUG modem &amp;lt;&amp;lt; }
2021-01-07T10:28:26.009Z DEBUG modem &amp;lt;&amp;lt; }
2021-01-07T10:28:26.504Z DEBUG modem &amp;lt;&amp;lt; [1;1H[2JTracking: 0 Using: 0 Unhealthy: 0
2021-01-07T10:28:26.517Z DEBUG modem &amp;lt;&amp;lt; ---------------------------------
2021-01-07T10:28:26.518Z DEBUG modem &amp;lt;&amp;lt; Seconds since last fix: 13
2021-01-07T10:28:26.518Z DEBUG modem &amp;lt;&amp;lt; Searching [\]
2021-01-07T10:28:26.519Z DEBUG modem &amp;lt;&amp;lt; NMEA strings:
2021-01-07T10:28:27.017Z DEBUG modem &amp;lt;&amp;lt; ---------------------------------[1;1H[2JTracking: 0 Using: 0 Unhealthy: 0
2021-01-07T10:28:27.019Z DEBUG modem &amp;lt;&amp;lt; ---------------------------------
2021-01-07T10:28:27.020Z DEBUG modem &amp;lt;&amp;lt; Seconds since last fix: 14
2021-01-07T10:28:27.020Z DEBUG modem &amp;lt;&amp;lt; Searching [|]
2021-01-07T10:28:27.020Z DEBUG modem &amp;lt;&amp;lt; NMEA strings:
2021-01-07T10:28:27.533Z DEBUG modem &amp;lt;&amp;lt; ---------------------------------[1;1H[2JTracking: 0 Using: 0 Unhealthy: 0
2021-01-07T10:28:27.551Z DEBUG modem &amp;lt;&amp;lt; ---------------------------------
2021-01-07T10:28:27.553Z DEBUG modem &amp;lt;&amp;lt; Seconds since last fix: 14
2021-01-07T10:28:27.554Z DEBUG modem &amp;lt;&amp;lt; Searching [/]
2021-01-07T10:28:27.556Z DEBUG modem &amp;lt;&amp;lt; NMEA strings:
2021-01-07T10:28:28.037Z DEBUG modem &amp;lt;&amp;lt; ---------------------------------[1;1H[2JTracking: 0 Using: 0 Unhealthy: 0
2021-01-07T10:28:28.048Z DEBUG modem &amp;lt;&amp;lt; ---------------------------------
2021-01-07T10:28:28.049Z DEBUG modem &amp;lt;&amp;lt; Seconds since last fix: 15
2021-01-07T10:28:28.049Z DEBUG modem &amp;lt;&amp;lt; Searching [-]
2021-01-07T10:28:28.054Z DEBUG modem &amp;lt;&amp;lt; NMEA strings:
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Enclosing the prj, main, and Log files.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;If you see the Log file the way I initialized the modem only allowing to run AWS_IOT properly.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: GPS and accelerometer data to own AWS server</title><link>https://devzone.nordicsemi.com/thread/287908?ContentTypeID=1</link><pubDate>Thu, 07 Jan 2021 10:25:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2064b6ec-6d07-4df3-9204-22431bc5afaf</guid><dc:creator>Rkidechaa</dc:creator><description>[quote userid="73166" url="~/f/nordic-q-a/70097/gps-and-accelerometer-data-to-own-aws-server/287906#287906"]Do you have CONFIG_LTE_AUTO_INIT_AND_CONNECT enabled in prj.conf? It looks like the modem initializes automatically.[/quote]
&lt;p&gt;No. It is disabled. If you want can share prj and main.c file&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: GPS and accelerometer data to own AWS server</title><link>https://devzone.nordicsemi.com/thread/287906?ContentTypeID=1</link><pubDate>Thu, 07 Jan 2021 10:19:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0c697ef8-a500-4adb-9710-b9e2527363dc</guid><dc:creator>Hakon</dc:creator><description>&lt;p&gt;Do you have CONFIG_LTE_AUTO_INIT_AND_CONNECT enabled in prj.conf? It looks like the modem initializes automatically.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: GPS and accelerometer data to own AWS server</title><link>https://devzone.nordicsemi.com/thread/287603?ContentTypeID=1</link><pubDate>Wed, 06 Jan 2021 00:03:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:47cf3179-a23d-4209-8e0c-999cc58e4608</guid><dc:creator>Rkidechaa</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I understood.&lt;/p&gt;
&lt;p&gt;SO I tried to merge the AWS_IOT sample and GPS code. In both the code they have initialized the modem. Shown below:&lt;/p&gt;
&lt;p&gt;From GPS sample&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;	if (init_app() != 0) {
		return -1;
	}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;From AWS_IOT sample&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;#if defined(CONFIG_BSD_LIBRARY)
	modem_configure();

	err = modem_info_init();
	if (err) {
		printk(&amp;quot;Failed initializing modem info module, error: %d\n&amp;quot;,
			err);
	}
	k_sem_take(&amp;amp;lte_connected, K_FOREVER);
	
#endif&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;While I am calling both in the main function getting a &amp;quot;failed to initialize modem&amp;quot; error.&lt;/p&gt;
&lt;pre&gt;&lt;img src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1609891308519v1.png" alt=" " /&gt;&lt;br /&gt;&lt;br /&gt;Can you help me out to solve the above error&lt;br /&gt;&lt;br /&gt;With regards,&lt;br /&gt;Rahul Kidecha&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: GPS and accelerometer data to own AWS server</title><link>https://devzone.nordicsemi.com/thread/287521?ContentTypeID=1</link><pubDate>Tue, 05 Jan 2021 13:29:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7af2e90a-8328-4252-bd2b-15445f3b2f76</guid><dc:creator>Hakon</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
[quote user=""]which one would be the easiest way to use to satisfy requirements.[/quote]
&lt;p&gt;&amp;nbsp;The easiest solution would be to just use regular GPS, if you don&amp;#39;t care about performance. A-GPS is used for performance reasons, not necessarily because it is easy to use. A-GPS requires additional data to be downloaded from a server before the GPS can be used.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>