<?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>A-GPS almanac request</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/102934/a-gps-almanac-request</link><description>What are the conditions under which the ` sv_mask_alm ` field in ` struct nrf_modem_gnss_agps_data_frame ` will stop being 0xFFFFFFFF? 
 I am providing almanac data for SV&amp;#39;s 2-32 (generated from nRF Cloud today) by writing with `NRF_MODEM_GNSS_AGPS_ALMANAC</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Sat, 19 Aug 2023 02:47:35 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/102934/a-gps-almanac-request" /><item><title>RE: A-GPS almanac request</title><link>https://devzone.nordicsemi.com/thread/442150?ContentTypeID=1</link><pubDate>Sat, 19 Aug 2023 02:47:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b70e1c11-e640-4bcf-b24e-12537aad4b13</guid><dc:creator>JordanYates</dc:creator><description>&lt;p&gt;&amp;gt;&amp;nbsp;&lt;span&gt;This can happen at most once an hour and the data is only updated when the event is sent.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Great, this is the information I was looking for and explains the behaviour I was seeing. I was expecting that additional calls would take into account provided information, not cache old state.&lt;/p&gt;
&lt;p&gt;As a side note, it is kind of annoying that `&lt;span&gt;nrf_modem_gnss_agps_expiry_get` returns expiry in seconds, and that the value is 0 until the time is known. This means that while &amp;quot;can be called anytime&amp;quot; is technically true, in practice it can only usefully be called once the modem has the time. A function that returns absolute expiry time would be more useful to me personally (and would be trivially convertible&amp;nbsp;to a relative time if desired).&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Thanks for your help.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: A-GPS almanac request</title><link>https://devzone.nordicsemi.com/thread/442086?ContentTypeID=1</link><pubDate>Fri, 18 Aug 2023 12:32:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:111f9188-26c7-4a59-b1d4-46e7a13b4f6a</guid><dc:creator>Amanda Hsieh</dc:creator><description>&lt;p&gt;Hi,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;There are two ways to query assistance data need from GNSS. &lt;span&gt;nrf_modem_gnss_agps_expiry_get() can be called anytime and will report expiration times in seconds for all A-GPS data.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Another way is to wait for an &lt;span&gt;NRF_MODEM_GNSS_EVT_AGPS_REQ event and then read the data need using function &lt;/span&gt;&lt;span&gt;&lt;/span&gt;&lt;span&gt;nrf_modem_gnss_read() and type &lt;/span&gt;&lt;span&gt;&lt;/span&gt;&lt;span&gt;NRF_MODEM_GNSS_DATA_AGPS_REQ. As the documentation says, the event is sent when GNSS needs new assistance data. This can happen at most once an hour and the data is only updated when the event is sent. If nrf_modem_gnss_read() is called again before the new NRF_MODEM_GNSS_EVT_AGPS_REQ event is received, it will just return the same same as before.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;So, if you want to check the A-GPS data need before GNSS asks for new data, you must use nrf_modem_gnss_agps_expiry_get().&lt;/p&gt;
&lt;p&gt;Regards,&lt;br /&gt;Amanda H.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: A-GPS almanac request</title><link>https://devzone.nordicsemi.com/thread/441771?ContentTypeID=1</link><pubDate>Thu, 17 Aug 2023 07:43:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ce48b966-107d-41a9-8fb6-7d425365cf8c</guid><dc:creator>JordanYates</dc:creator><description>&lt;p&gt;The high level code operation doing this work looks like this:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;static void agps_provide(void)
{
	struct nrf_modem_gnss_agps_data_frame agps_frame;
	struct nrf_modem_gnss_agps_data_location location;
	int rc;

	/* Query any required GNSS assistance */
	rc = nrf_modem_gnss_read(&amp;amp;agps_frame, sizeof(agps_frame), NRF_MODEM_GNSS_DATA_AGPS_REQ);
	if (rc &amp;lt; 0) {
		LOG_ERR(&amp;quot;Failed to read AGPS request (%d)&amp;quot;, rc);
		return;
	}

	if (agps_frame.sv_mask_alm) {
		/* Write data to NRF_MODEM_GNSS_AGPS_ALMANAC */
		almanac_assistance(agps_frame.sv_mask_alm);
	}
	if (agps_frame.data_flags &amp;amp; NRF_MODEM_GNSS_AGPS_SYS_TIME_AND_SV_TOW_REQUEST) {
		/* Write data to NRF_MODEM_GNSS_AGPS_GPS_SYSTEM_CLOCK_AND_TOWS */
		time_assistance();
	}
	if (agps_frame.data_flags &amp;amp; NRF_MODEM_GNSS_AGPS_POSITION_REQUEST) {
		if ((location_assistance_mcc(&amp;amp;location) == 0)) {
			/* Write data to NRF_MODEM_GNSS_AGPS_LOCATION */
			location_assistance_provide(&amp;amp;location);
		}
	}
}

static void run_fix(void)
{
	nrf_modem_gnss_start();
	agps_provide();
	while(running_fix) ;
	nrf_modem_gnss_stop();
}&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>