lriot 2.1.0.0
lr1110_modem_helper.h File Reference

helper functions definition for LR1110 modem More...

#include <stdbool.h>
#include <stdint.h>
#include "modem/lr1110_modem_helper_types.h"
#include "modem/lr1110_modem_common.h"
#include "modem/lr1110_modem_lorawan.h"
#include "modem/lr1110_modem_gnss.h"

Go to the source code of this file.

Functions

err_t lr1110_modem_helper_get_utc_time (lriot_t *ctx, uint32_t *time)
 Query the current UTC time.
 
err_t lr1110_modem_helper_gnss_get_gnss_week_number_rollover (lriot_t *ctx, uint8_t *gnss_week_number_rollover)
 Compute the Gnss Week Number Rollover.
 
err_t lr1110_modem_helper_gnss_get_almanac_date_by_index (lriot_t *ctx, uint8_t sv_id, uint32_t *date, uint8_t gnss_week_number_rollover)
 Read the almanac date by SV index.
 
err_t lr1110_modem_helper_gnss_get_result_destination (uint8_t *result_buffer, uint16_t result_buffer_size, uint8_t *destination)
 Extract the destination from the result returned by a GNSS scan.
 
err_t lr1110_modem_helper_gnss_get_event_type (uint8_t *result_buffer, uint16_t result_buffer_size, lr1110_modem_gnss_scan_done_event_t *event_type)
 Extract the event type from the result returned by a GNSS scan,.
 
err_t lr1110_modem_helper_get_event_data (lriot_t *ctx, lr1110_modem_event_t *modem_event)
 Extract the event data contained in the event field buffer.
 

Detailed Description

helper functions definition for LR1110 modem

Revised BSD License Copyright Semtech Corporation 2020. All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  • Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  • Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
  • Neither the name of the Semtech corporation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SEMTECH CORPORATION BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Function Documentation

◆ lr1110_modem_helper_get_event_data()

err_t lr1110_modem_helper_get_event_data ( lriot_t * ctx,
lr1110_modem_event_t * modem_event )

Extract the event data contained in the event field buffer.

Parameters
[in]ctxChip implementation context
[out]modem_eventStruct containing the event data
See also
lr1110_modem_event_t
Returns
Operation status

◆ lr1110_modem_helper_get_utc_time()

err_t lr1110_modem_helper_get_utc_time ( lriot_t * ctx,
uint32_t * time )

Query the current UTC time.

Note
the conversion is based on the Modem-E GPS date, The application layer clock synchronization shall be received before call this function.
Parameters
[in]ctxChip implementation context
[out]timeUTC Time in seconds
Returns
Operation status

◆ lr1110_modem_helper_gnss_get_almanac_date_by_index()

err_t lr1110_modem_helper_gnss_get_almanac_date_by_index ( lriot_t * ctx,
uint8_t sv_id,
uint32_t * date,
uint8_t gnss_week_number_rollover )

Read the almanac date by SV index.

Parameters
[in]ctxChip implementation context
[in]sv_idSatellite ID
[out]dateAlmanac date UTC format in second
Note
if the returned date is 0 it means that the SV is not activated
Parameters
[in]gnss_week_number_rolloverNumber of GPS Week Number Rollover which is a phenomenon that happens every 1024 weeks
Returns
Operation status

◆ lr1110_modem_helper_gnss_get_event_type()

err_t lr1110_modem_helper_gnss_get_event_type ( uint8_t * result_buffer,
uint16_t result_buffer_size,
lr1110_modem_gnss_scan_done_event_t * event_type )

Extract the event type from the result returned by a GNSS scan,.

Note
a event type exists only if the destination is LR1110_MODEM_GNSS_DESTINATION_HOST
Parameters
[in]result_bufferPointer to the buffer holding the result
[in]result_buffer_sizeSize of the result in byte
[out]event_typeEvent type of the result
See also
lr1110_modem_gnss_scan_done_event_t
Returns
Operation status

◆ lr1110_modem_helper_gnss_get_gnss_week_number_rollover()

err_t lr1110_modem_helper_gnss_get_gnss_week_number_rollover ( lriot_t * ctx,
uint8_t * gnss_week_number_rollover )

Compute the Gnss Week Number Rollover.

Note
the computation is based on the Modem-E GPS date, The application layer clock synchronization shall be received before call this function.
Parameters
[in]ctxChip implementation context
[out]gnss_week_number_rolloverNumber of GPS Week Number Rollover which is a phenomenon that happens every 1024 weeks
Returns
Operation status

◆ lr1110_modem_helper_gnss_get_result_destination()

err_t lr1110_modem_helper_gnss_get_result_destination ( uint8_t * result_buffer,
uint16_t result_buffer_size,
uint8_t * destination )

Extract the destination from the result returned by a GNSS scan.

Parameters
[in]result_bufferPointer to the buffer holding the result
[in]result_buffer_sizeSize of the result in byte
[out]destinationDestination of the result
See also
lr1110_modem_gnss_destination_t
Returns
Operation status