Legrand / Raritan / Server Technology Xerus™ JSON-RPC API
Loading...
Searching...
No Matches
datetime::DateTime Interface Reference

Date and time configuration methods. More...

import "DateTime.idl";

Classes

struct  Cfg
 Device date and time configuration. More...
 
struct  ClockChangedEvent
 Event that is sent when the device time is changed. More...
 
struct  ConfigurationChangedEvent
 Event that is sent when the configuration changes. More...
 
struct  NtpAuthKey
 NTP authentication key. More...
 
struct  NtpCfg
 Static NTP server configuration. More...
 
struct  ZoneCfg
 Time zone configuration. More...
 
struct  ZoneInfo
 Time zone information (see also ZoneCfg) More...
 

Public Types

enum  Protocol { STATIC , NTP }
 Time synchronization protocol. More...
 
enum  NtpAuthKeyType { SHA256 , SHA512 , AES128CMAC , AES256CMAC }
 NTP authentication key type. More...
 

Public Member Functions

void getZoneInfos (out vector< ZoneInfo > zoneInfos, in boolean useOlson)
 List all supported time zones.
 
int checkNtpServer (in string ntpServer, in int ntpAuthKeyId, in NtpAuthKey ntpAuthKeyOverride)
 Check if a specified NTP server is usable.
 
vector< string > getActiveNtpServers ()
 Get active NTP servers.
 
void getCfg (out Cfg cfg)
 Retrieve the device date and time configuration.
 
int setCfg (in Cfg cfg)
 Set the device date and time configuration.
 
void getTime (in boolean useOlson, out ZoneInfo zone, out boolean dstEnabled, out int utcOffset, out time currentTime)
 Retrieve the current device date and time.
 

Public Attributes

constant int SUCCESS = 0
 Success code.
 
constant int ERR_NTP_CHECK_INTERNAL = 1
 NTP server check errors.
 
constant int ERR_NTP_CHECK_INVALID_ARGUMENT = 2
 
constant int ERR_NTP_CHECK_ADDRESS_RESOLVE_ERROR = 3
 
constant int ERR_NTP_CHECK_AUTH_KEY_ID_UNKNOWN = 4
 
constant int ERR_NTP_CHECK_NETWORK_OR_HOST_UNREACHABLE = 5
 
constant int ERR_NTP_CHECK_CONNECTION_REFUSED = 6
 
constant int ERR_NTP_CHECK_NO_RESPONSE = 7
 
constant int ERR_NTP_CHECK_RESPONSE_FORMAT_INVALID = 8
 
constant int ERR_NTP_CHECK_SERVER_VERSION_UNSUPPORTED = 9
 
constant int ERR_NTP_CHECK_MAC_MISSING_OR_INVALID = 10
 
constant int ERR_NTP_CHECK_MODE_INVALID = 11
 
constant int ERR_NTP_CHECK_SERVER_NOT_SYNCHRONIZED = 12
 
constant int ERR_NTP_CHECK_ROOT_DISTANCE_TOO_LARGE = 13
 
constant int ERR_NTP_CHECK_ORIGIN_TIME_DOES_NOT_MATCH = 14
 
constant int ERR_NTP_CHECK_RECV_OR_XMIT_TIME_NOT_SET = 15
 

Detailed Description

Date and time configuration methods.

Example to set timezone (id-based approach):

zoneinfos = getZoneInfos(False)
cfg = getCfg()
cfg.zoneCfg.id = ... # choose zone id from returned zoneinfos
status = setCfg(cfg)
if status != 0: ... # error handling

Definition at line 26 of file DateTime.idl.

Member Enumeration Documentation

◆ NtpAuthKeyType

NTP authentication key type.

Enumerator
SHA256 

SHA-256 authentication key.

SHA512 

SHA-512 authentication key.

AES128CMAC 

AES128-CMAC authentication key.

AES256CMAC 

AES256-CMAC authentication key.

Definition at line 95 of file DateTime.idl.

◆ Protocol

Time synchronization protocol.

Enumerator
STATIC 

Device time is configured locally.

NTP 

Device time is synchronized via NTP.

Definition at line 89 of file DateTime.idl.

Member Function Documentation

◆ checkNtpServer()

int datetime::DateTime::checkNtpServer ( in string ntpServer,
in int ntpAuthKeyId,
in NtpAuthKey ntpAuthKeyOverride )

Check if a specified NTP server is usable.

When calling this method a potentially referenced authentication key must have been defined first.

Parameters
ntpServerNTP server to be checked
ntpAuthKeyIdNTP authentication key id (0 for no authentication)
ntpAuthKeyOverrideNTP authentication key (leave key data empty to use existing key & type)
Returns
SUCCESS or one of the ERR_NTP_CHECK_* error codes

◆ getActiveNtpServers()

vector< string > datetime::DateTime::getActiveNtpServers ( )

Get active NTP servers.

Returns
List of currently active NTP servers (IP addresses and/or hostnames)

◆ getCfg()

void datetime::DateTime::getCfg ( out Cfg cfg)

Retrieve the device date and time configuration.

Parameters
cfgResult: Current date and time configuration

◆ getTime()

void datetime::DateTime::getTime ( in boolean useOlson,
out ZoneInfo zone,
out boolean dstEnabled,
out int utcOffset,
out time currentTime )

Retrieve the current device date and time.

Parameters
useOlsonUse Olson timezone name (see also ZoneCfg)
zoneResult: Active time zone
dstEnabledif false, the time zone daylight saving time flag is not used
utcOffsetResult: Offset (in minutes) between local time and UTC
currentTimeResult: Device date and time (UNIX timestamp, UTC)

◆ getZoneInfos()

void datetime::DateTime::getZoneInfos ( out vector< ZoneInfo > zoneInfos,
in boolean useOlson )

List all supported time zones.

Parameters
zoneInfosResult: List of time zones
useOlsonUse Olson timezone names (see also ZoneCfg)

◆ setCfg()

int datetime::DateTime::setCfg ( in Cfg cfg)

Set the device date and time configuration.

Depending on the value of the protocol field either deviceTime or ntpCfg will be used from the cfg parameter.

Specific example to set timezone.

Parameters
cfgNew date and time configuration.
Returns
0 if OK
1 if the configuration is invalid

Member Data Documentation

◆ ERR_NTP_CHECK_ADDRESS_RESOLVE_ERROR

constant int datetime::DateTime::ERR_NTP_CHECK_ADDRESS_RESOLVE_ERROR = 3

Definition at line 34 of file DateTime.idl.

◆ ERR_NTP_CHECK_AUTH_KEY_ID_UNKNOWN

constant int datetime::DateTime::ERR_NTP_CHECK_AUTH_KEY_ID_UNKNOWN = 4

Definition at line 35 of file DateTime.idl.

◆ ERR_NTP_CHECK_CONNECTION_REFUSED

constant int datetime::DateTime::ERR_NTP_CHECK_CONNECTION_REFUSED = 6

Definition at line 37 of file DateTime.idl.

◆ ERR_NTP_CHECK_INTERNAL

constant int datetime::DateTime::ERR_NTP_CHECK_INTERNAL = 1

NTP server check errors.

Definition at line 32 of file DateTime.idl.

◆ ERR_NTP_CHECK_INVALID_ARGUMENT

constant int datetime::DateTime::ERR_NTP_CHECK_INVALID_ARGUMENT = 2

Definition at line 33 of file DateTime.idl.

◆ ERR_NTP_CHECK_MAC_MISSING_OR_INVALID

constant int datetime::DateTime::ERR_NTP_CHECK_MAC_MISSING_OR_INVALID = 10

Definition at line 41 of file DateTime.idl.

◆ ERR_NTP_CHECK_MODE_INVALID

constant int datetime::DateTime::ERR_NTP_CHECK_MODE_INVALID = 11

Definition at line 42 of file DateTime.idl.

◆ ERR_NTP_CHECK_NETWORK_OR_HOST_UNREACHABLE

constant int datetime::DateTime::ERR_NTP_CHECK_NETWORK_OR_HOST_UNREACHABLE = 5

Definition at line 36 of file DateTime.idl.

◆ ERR_NTP_CHECK_NO_RESPONSE

constant int datetime::DateTime::ERR_NTP_CHECK_NO_RESPONSE = 7

Definition at line 38 of file DateTime.idl.

◆ ERR_NTP_CHECK_ORIGIN_TIME_DOES_NOT_MATCH

constant int datetime::DateTime::ERR_NTP_CHECK_ORIGIN_TIME_DOES_NOT_MATCH = 14

Definition at line 45 of file DateTime.idl.

◆ ERR_NTP_CHECK_RECV_OR_XMIT_TIME_NOT_SET

constant int datetime::DateTime::ERR_NTP_CHECK_RECV_OR_XMIT_TIME_NOT_SET = 15

Definition at line 46 of file DateTime.idl.

◆ ERR_NTP_CHECK_RESPONSE_FORMAT_INVALID

constant int datetime::DateTime::ERR_NTP_CHECK_RESPONSE_FORMAT_INVALID = 8

Definition at line 39 of file DateTime.idl.

◆ ERR_NTP_CHECK_ROOT_DISTANCE_TOO_LARGE

constant int datetime::DateTime::ERR_NTP_CHECK_ROOT_DISTANCE_TOO_LARGE = 13

Definition at line 44 of file DateTime.idl.

◆ ERR_NTP_CHECK_SERVER_NOT_SYNCHRONIZED

constant int datetime::DateTime::ERR_NTP_CHECK_SERVER_NOT_SYNCHRONIZED = 12

Definition at line 43 of file DateTime.idl.

◆ ERR_NTP_CHECK_SERVER_VERSION_UNSUPPORTED

constant int datetime::DateTime::ERR_NTP_CHECK_SERVER_VERSION_UNSUPPORTED = 9

Definition at line 40 of file DateTime.idl.

◆ SUCCESS

constant int datetime::DateTime::SUCCESS = 0

Success code.

Definition at line 29 of file DateTime.idl.


The documentation for this interface was generated from the following file: