System API

Non hardware interface related API.

SDK version

voidSDKVersionGet(uint32_t * Major,uint32_t * Minor,uint32_t * Patch)

Application initialisation

User defined application initialisation logic.

voidAppInit(void)

Must be implemented by the application.

Will be called at device startup before any application jobs.

Time and job scheduling

intScheduleJob(ScheduledJobJob,time_t Time)

Reset the schedule for an existing job or add a new job.

Return 0 if succeeded and -1 if maximum number of jobs reached.

time_tASAP(void)

time_tNever(void)

time_tSecondsFromNow(unsigned Secs)

time_tMinutesFromNow(unsigned Mins)

time_tHoursFromNow(unsigned Hours)

time_tDaysFromNow(unsigned Days)

time_tOnGPIOWakeup(void)

GPIO wakeup event.

time_tOnPulseCounterEvent(void)

Pulse counter overflow event.

time_tBeforeSatelliteTransmit(time_t After,time_t Before)

Return a time after After and before Before immediately prior to a satellite transmit opportunity.

Can be used to reduce latency between sensor reading and satellite transmission. If no opportunity is found between After and Before, then Before is returned.

User message

#defineMAX_MESSAGE_SIZE20

Maximum size in bytes of individual transmit message.

floatScheduleMessage(const uint8_t * Message,size_t MessageSize)

Schedule a message of bytes of given size for transmission.

The maximum message size is given by MAX_MESSAGE_SIZE. Returns message load. Return values greater than one indicate that messages are being scheduled too quickly. NAN is returned if an error occurs, for example, if the MessageSize exceeds MAX_MESSAGE_SIZE.

Delays

voidDelay(uint32_t mSec)

Delay for a number of milliseconds.

voidSleep(uint32_t Sec)

Put the system in lower power mode for Sec seconds.

The current job won't be interrupted by other jobs while sleeping.

Time and location

intGNSSFix(void)

Get a time and location fix from GNSS.

Updates real-time clock and latitude and longitude values. Returns 0 if GNSS fix was correctly obtained and -1 otherwise.

boolHasValidGNSSFix(void)

Returns true if the system has obtained a valid time and location fix.

voidLocationGet(int32_t * Latitude,int32_t * Longitude,time_t * TimeStamp)

Returns last recorded latitude and longitude in fixed point format and timestamp of last fix.

Values are in degrees multiplied by 1e7.

time_tTimeGet(void)

Get current epoch time.

Temperature sensor

intTemperatureGet(float * Temperature)

Get on board temperature in degrees Celsius Returns 0 if succeeded and -1 if failed.

LED control

voidLedTurnOn(void)

voidLedTurnOff(void)

voidLedToggle(void)

Battery voltage

intBatteryGetVoltage(uint32_t * mV)

Get the battery voltage in millivolt.

Returns 0 if succeeded and -1 if failed. If battery measurement is not supported then both voltage and the return value are 0.

System tick

uint32_tTickGet(void)

Get the current system tick (1000 ticks per second).

Error logging

intLogAdd(uint8_t ErrorCode,const void * Buffer,uint8_t BufferSize)

Log errors.

Error codes are user defined (0 - 127). The size can be 0 to log only the error code Returns 0 if logging succeeds and -1 if logging fails.