C Porting Layer API Reference for Oracle Internet of Things Cloud Service Client Software Library. Release 21.1.1.0.0-3. E80003-19
iotcs_port_system.h File Reference

The file contains porting layer for system methods. More...

#include <inttypes.h>
#include "iotcs_config.h"

Go to the source code of this file.

Defines

#define IOTCS_SEC_TO_MILLISEC(sec)   (((int64_t) (sec)) * 1000)
#define IOTCS_MILLISEC_TO_SEC(msec)   ((msec) / 1000)
#define IOTCS_MILLISEC_TO_NANOSEC(msec)   ((msec) * 1000000)
#define IOTCS_MICROSEC_TO_MILLISEC(microsec)   ((microsec) / 1000)
#define IOTCS_MICROSEC_TO_NANOSEC(microsec)   ((microsec) * 1000)
#define IOTCS_NANOSEC_TO_MILLISEC(nanosec)   ((nanosec) / 1000000)

Functions

void iotcs_port_platform_init ()
 Initializes the platform Library calls this method during library's initialization and before it starts using any port API.
void iotcs_port_platform_finilize ()
 Finalizes the platform Library calls this method during library's finalization and after it stopped using port API.
int64_t iotcs_port_get_current_time_millis (void)
 Number of milliseconds since Epoch.
void iotcs_port_set_current_time (int64_t seconds)
 Sets current server time in seconds since Epoch When IOTCS_USE_SERVER_TIME is enabled and HTTPS protocol is used and request to get access token failed (probably because of time difference between device and server) then, library parses server response, extracts server time from it and passes result to this call.
const char * iotcs_port_get_os_name (void)
 Returns null terminated string with operation system name Used in /iot/api/v2/activation/policy?OSName=XXX&OSVersion=YYY REST API call in place of XXX.
const char * iotcs_port_get_os_version (void)
 Returns null terminated string with operation system version Used in /iot/api/v2/activation/policy?OSName=XXX&OSVersion=YYY REST API call in place of YYY.
const char * iotcs_port_get_http_proxy (void)
 Returns null terminated string like "proxy_host:proxy_port".

Detailed Description

The file contains porting layer for system methods.


Function Documentation

int64_t iotcs_port_get_current_time_millis ( void  )

Number of milliseconds since Epoch.

Note:
Mandatory API. Called by the Library in any configuration.
Returns:
Number of milliseconds since Epoch
const char* iotcs_port_get_http_proxy ( void  )

Returns null terminated string like "proxy_host:proxy_port".

Note:
Mandatory API. Called by the Library in any connection.
Returns:
null terminated string with operation system version
const char* iotcs_port_get_os_name ( void  )

Returns null terminated string with operation system name Used in /iot/api/v2/activation/policy?OSName=XXX&OSVersion=YYY REST API call in place of XXX.

For more info please read REST API documentation.

Note:
Mandatory API. Called by the Library in any configuration.
Returns:
null terminated string with operation system name
const char* iotcs_port_get_os_version ( void  )

Returns null terminated string with operation system version Used in /iot/api/v2/activation/policy?OSName=XXX&OSVersion=YYY REST API call in place of YYY.

For more info please read REST API documentation.

Note:
Mandatory API. Called by the Library in any configuration.
Returns:
null terminated string with operation system version
void iotcs_port_platform_finilize ( )

Finalizes the platform Library calls this method during library's finalization and after it stopped using port API.

Note:
Mandatory API. Called by the Library in any configuration.
void iotcs_port_platform_init ( )

Initializes the platform Library calls this method during library's initialization and before it starts using any port API.

Note:
Mandatory API. Called by the Library in any configuration.
void iotcs_port_set_current_time ( int64_t  seconds)

Sets current server time in seconds since Epoch When IOTCS_USE_SERVER_TIME is enabled and HTTPS protocol is used and request to get access token failed (probably because of time difference between device and server) then, library parses server response, extracts server time from it and passes result to this call.

Implementation doesn't have to adjust hardware RTC, it could just calculate a time difference and adjust return value of iotcs_port_get_current_time_millis call by the difference.

Note:
Optional API. Called by the Library if IOTCS_USE_SERVER_TIME option is defined.
Parameters:
secondscurrent server time in seconds since Epoch