> For the complete documentation index, see [llms.txt](https://sandbox-docs.verifone.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://sandbox-docs.verifone.com/adk-5.0-programmers-guide/vfisyspm_8h_source.md).

# vfisyspm.h

[Go to the documentation of this file.](/adk-5.0-programmers-guide/readme/files/dir_2fa442697ca4f3ad26ee86a05c70c5ba/dir_8c98103bf86c0a8e400b3720f3ef5f71/dir_c6564d074bdc7edceae1f5f34995b8b1/vfisyspm_8h.md)

```cpp
 1 #pragma once
 2 
 3 #include <stdio.h>
 4 #include <stdlib.h>
 5 #include <time.h>
 6 #include "ipc/jsobject.h"
 7 
 13 #if defined VFI_SYS_PM_DLL_EXPORT
 14  #define VFI_SYS_PM_API __attribute__((visibility ("default")))
 15 
 16 #else
 17  #define VFI_SYS_PM_API
 18 
 19 #endif
 20 
 21 // fix for typo in enum
 22 #define PM_SUPRESS_NONE PM_SUPPRESS_NONE
 23 #define PM_SUPRESS_CRITICAL_SECTION PM_SUPPRESS_CRITICAL_SECTION
 24 #define PM_SUPRESS_CHARGE_CHECK PM_SUPPRESS_CHARGE_CHECK
 25 #define PM_SUPRESS_ALL PM_SUPPRESS_ALL
 26 
 27 #ifndef DOXYGEN
 28 
 29 namespace vfisyspm
 30 {
 31 #endif
 32 
 34 enum vfisyspmError
 35 {
 36  SYS_PM_ERR_OK = 0,
 37  SYS_PM_ERR_FAIL = -1,
 38  SYS_PM_ERR_UNSUPPORTED = -2,
 39  SYS_PM_ERR_UNKNOWN = -3,
 40  SYS_PM_ERR_DAEMON_COM = -4,
 41  SYS_PM_ERR_TIMEOUT = -5,
 42  SYS_PM_ERR_LIBNOTIFY = -6,
 43  SYS_PM_ERR_IPC = -7,
 44  SYS_PM_ERR_NOT_RUNNING = -8,
 45  SYS_PM_ERR_PARAM = -9,
 46  SYS_PM_ERR_INIT = -10,
 47  SYS_PM_ERR_IN_CRIT_SECTION = -11,
 48  SYS_PM_ERR_POWER = -12,
 49  SYS_PM_ERR_CHARGING = -13,
 50  SYS_PM_ERR_CONFIG = -14,
 51  SYS_PM_ERR_NON_EXISTING = -15,
 52  SYS_PM_ERR_NOTIFY_SVC = -16,
 53  SYS_PM_ERR_TIMER = -17,
 54  SYS_PM_ERR_ALREADY_INIT = -18,
 55  SYS_PM_ERR_ALLOWED = -19,
 56  SYS_PM_ERR_STATE = -20,
 57  SYS_PM_ERR_LOW_LEVEL = -21,
 58  SYS_PM_ERR_WAKE_UP_IS_PENDING = -22,
 59 };
 60 
 62 enum vfisyspmNotificationType
 63 {
 64  PM_NOTIFY_TYPE_NONE = 0,
 65  PM_NOTIFY_TYPE_POWER_MODE = (1 << 0),
 66  PM_NOTIFY_TYPE_DOCK_STATE = (1 << 1),
 67  PM_NOTIFY_TYPE_POWER_SOURCE = (1 << 2),
 68  PM_NOTIFY_TYPE_WAKEUP_SOURCE = (1 << 3),
 69  PM_NOTIFY_TYPE_CRITICAL_SECTION = (1 << 4),
 70  PM_NOTIFY_TYPE_PCI_REBOOT = (1 << 5),
 71  PM_NOTIFY_TYPE_POWER_BUTTON = (1 << 6),
 72  PM_NOTIFY_SYSTEM_GROUP_ONLY = (1 << 7),
 73  PM_NOTIFY_TYPE_LAST = (1 << 8),
 74  PM_NOTIFY_TYPE_ALL = 0xFFFF,
 75 };
 76 
 78 enum vfisyspmTimerFlags
 79 {
 80  PM_TIMER_NONE = 0,
 81  PM_TIMER_NO_WAKE_UP = (1 << 0),
 82 };
 83 
 85 enum vfisyspmChargningModes
 86 {
 87  PM_CHARGING_MODE_UNRESTRICTED = 1,
 88  PM_CHARGING_MODE_CAR_CHARGER = 2,
 89 };
 90 
 91 
 93 enum vfisyspmTransitionFlags
 94 {
 95  PM_SUPPRESS_NONE = 0,
 96  PM_SUPPRESS_CRITICAL_SECTION = (1 << 0),
 97  PM_SUPPRESS_CHARGE_CHECK = (1 << 1),
 98  PM_SUPPRESS_BOOT_STATE = (1 << 2),
 99  PM_SYNC = (1 << 3),
 100  PM_SUPPRESS_ALL =
 101  PM_SUPPRESS_CRITICAL_SECTION | PM_SUPPRESS_CHARGE_CHECK | PM_SUPPRESS_BOOT_STATE
 102 };
 103 
 105 enum vfisyspmCritSectionParameters
 106 {
 107  PM_CRIT_NONE = 0,
 108  PM_CRIT_SUPRESS_STANDBY = (1 << 0),
 109 };
 110 
 112 enum powermngtState
 113 {
 114  BOOT =-1,
 115  ACTIVE = 0,
 116  STANDBY = 1,
 117  SLEEP = 2,
 118  DEEP_SLEEP = 3,
 119  HIBERNATE = 4,
 120  OFF = 5,
 121  REBOOT = 6,
 122  LAST = 9
 123 };
 124 
 126 enum vfisyspmNotifications
 127 {
 128  ENTER_BOOT = 37,
 129  ENTER_ACTIVE = 0,
 130  ENTER_STANDBY = 1,
 131  ENTER_SLEEP = 2,
 132  ENTER_DEEP_SLEEP = 13,
 133  ENTER_HIBERNATE = 10,
 134  ENTER_SHUTDOWN = 12,
 135  ENTER_REBOOT = 11,
 136  ENTER_SYSMODE = 27,
 137  ENTER_DOCKED = 3,
 138  ENTER_UNDOCKED = 4,
 139  ENTER_BATTERY = 5,
 140  ENTER_EXTERNAL_POWER = 6,
 141  ENTER_BATTERY_NORMAL = 26,
 142  ENTER_BATTERY_FULL = 7,
 143  ENTER_BATTERY_LOW = 8,
 144  ENTER_BATTERY_CRITICAL = 9,
 145  BATTERY_FAULT = 35,
 146  BATTERY_REMOVED = 36,
 147  BUTTON_X_PRESSED = 14,
 148  BUTTON_X_RELEASED = 15,
 149  PCI_REBOOT_WARNING = 17,
 150  WAKEUP = 16,
 151  WAKEUP_COMM = 18,
 152  WAKEUP_USB = 19,
 153  WAKEUP_CONSOLE = 20,
 154  WAKEUP_KEY_PRESS = 21,
 155  WAKEUP_TIMER = 22,
 156  WAKEUP_EXTERNAL = 23,
 157  CRITICAL_SECTION_ENABLED = 24,
 158  CRITICAL_SECTION_DISABLED = 25,
 159  ABORT_PINPAD_ENABLE = 28,
 160  ABORT_EARLY_WAKEUP = 29,
 161  ABORT_HMAC_PROCESSING = 30,
 162  ABORT_CRITICAL_SECTION = 31,
 163  ABORT_SYSTEM_ERROR = 32,
 164  CHARGING_MODE_UNRESTRICTED = 33,
 165  CHARGING_MODE_CAR_CHARGER = 34,
 166  POWER_BUTTON_PRESSED = 37,
 167  POWER_BUTTON_RELEASED = 38,
 168 };
 169 
 170 typedef int wakeupHandle; // wakeup handle
 171 typedef int timerHandle; // timer handle
 172 
 173 // Callback will receive JSON encoded timer information.
 174 // JSON will include: time, timer handle and passed message.
 175 // example:
 176 // {"handle":11,"message":"timer for 90 seconds","time":1510696636}
 177 typedef void (*timerNotificationCallback)( const vfiipc::JSObject & json ); // timer callback
 178 
 184 typedef void (*vfisyspmCallback)(vfisyspmNotificationType type, vfisyspmNotifications notification);
 185 
 186 /* Replica of the Linux structure tm in time.h */
 187 struct vfisyspm_DateTime
 188 {
 189  int tm_sec;
 190  int tm_min;
 191  int tm_hour;
 192  int tm_mday;
 193  int tm_mon;
 194  int tm_year;
 195  int tm_wday;
 196  int tm_yday;
 197  int tm_isdst;
 198 };
 199 
 206 VFI_SYS_PM_API vfisyspmError sys_Init();
 207 
 215 VFI_SYS_PM_API vfisyspmError sys_Init( vfisyspmCallback cb );
 216 
 225 VFI_SYS_PM_API vfisyspmError sys_Init( vfisyspmCallback cb, int typeMask );
 226 VFI_SYS_PM_API vfisyspmError sys_Init( vfisyspmCallback cb, vfisyspmNotificationType typeMask );
 227 
 232 VFI_SYS_PM_API vfisyspmError sys_Deinit();
 233 
 242 VFI_SYS_PM_API vfisyspmError sys_SetNotificationCB( vfisyspmCallback cb, vfisyspmNotificationType typeMask );
 243 
 251 VFI_SYS_PM_API vfisyspmError sys_SetChargingMode( vfisyspmChargningModes mode );
 252 
 260 VFI_SYS_PM_API vfisyspmError sys_GetChargingMode( vfisyspmChargningModes & mode );
 261 
 271 VFI_SYS_PM_API vfisyspmError sys_RefreshConfig();
 272 
 282 VFI_SYS_PM_API vfisyspmError sys_Active(int flags);
 283 VFI_SYS_PM_API vfisyspmError sys_Active();
 284 
 294 VFI_SYS_PM_API vfisyspmError sys_Standby(int flags);
 295 VFI_SYS_PM_API vfisyspmError sys_Standby();
 296 
 306 VFI_SYS_PM_API vfisyspmError sys_Sleep(int flags);
 307 VFI_SYS_PM_API vfisyspmError sys_Sleep();
 308 
 318 VFI_SYS_PM_API vfisyspmError sys_DeepSleep(int flags);
 319 VFI_SYS_PM_API vfisyspmError sys_DeepSleep();
 320 
 330 VFI_SYS_PM_API vfisyspmError sys_Hibernate(int flags);
 331 VFI_SYS_PM_API vfisyspmError sys_Hibernate();
 332 
 342 VFI_SYS_PM_API vfisyspmError sys_Shutdown(int flags);
 343 VFI_SYS_PM_API vfisyspmError sys_Shutdown();
 344 
 354 VFI_SYS_PM_API vfisyspmError sys_Reboot(int flags);
 355 VFI_SYS_PM_API vfisyspmError sys_Reboot();
 356 
 365 VFI_SYS_PM_API vfisyspmError sys_RebootDock();
 366 
 375 VFI_SYS_PM_API vfisyspmError sys_CriticalSectionEnter();
 376 
 386 VFI_SYS_PM_API vfisyspmError sys_CriticalSectionEnter(int params);
 387 
 396 VFI_SYS_PM_API vfisyspmError sys_CriticalSectionExit();
 397 
 407 VFI_SYS_PM_API vfisyspmError sys_CriticalSectionState( bool & state );
 408 
 418 VFI_SYS_PM_API vfisyspmError sys_SetWakeupTime( struct vfisyspm_DateTime * wakeupTime );
 419 
 430 VFI_SYS_PM_API vfisyspmError sys_SetWakeupTime(
 431  wakeupHandle & handle,
 432  const vfisyspm_DateTime & wakeup_time );
 433 
 444 VFI_SYS_PM_API vfisyspmError sys_SetWakeupTime(
 445  wakeupHandle & handle,
 446  time_t time );
 447 
 460 VFI_SYS_PM_API vfisyspmError sys_SetWakeupTime(
 461  wakeupHandle & handle,
 462  time_t time,
 463  powermngtState state,
 464  int flags);
 465 
 475 VFI_SYS_PM_API vfisyspmError sys_SetWakeupTime( time_t time );
 476 
 487 VFI_SYS_PM_API vfisyspmError sys_CancelWakeupTime( const wakeupHandle & handle );
 488 
 497 VFI_SYS_PM_API vfisyspmError sys_ClearWakeupTimes();
 498 
 511 VFI_SYS_PM_API vfisyspmError sys_SetPciRebootTime(struct vfisyspm_DateTime * rebootTime);
 512 
 525 VFI_SYS_PM_API vfisyspmError sys_GetPciRebootTime(struct vfisyspm_DateTime * rebootTime);
 526 
 536 VFI_SYS_PM_API vfisyspmError sys_ClearPciRebootTime();
 537 
 547 VFI_SYS_PM_API vfisyspmError sys_GetConfig( vfiipc::JSObject & config );
 548 
 559 VFI_SYS_PM_API vfisyspmError sys_SetConfig( const vfiipc::JSObject & config );
 560 
 573 VFI_SYS_PM_API vfisyspmError sys_SetTimer( timerHandle & handle,
 574  const vfisyspm_DateTime & time,
 575  const std::string & payload = "" );
 576 
 589 VFI_SYS_PM_API vfisyspmError sys_SetTimer( timerHandle & handle,
 590  const time_t time,
 591  const std::string & payload = "" );
 592 
 606 VFI_SYS_PM_API vfisyspmError sys_SetTimer( timerHandle & handle,
 607  const time_t time,
 608  const std::string & payload,
 609  timerNotificationCallback cb,
 610  int flags = 0 );
 611 
 622 VFI_SYS_PM_API vfisyspmError sys_CancelTimer( const timerHandle & handle );
 623 
 632 VFI_SYS_PM_API vfisyspmError sys_CancelTimers();
 633 
 645 VFI_SYS_PM_API vfisyspmError sys_CancelSleep();
 646 
 658 VFI_SYS_PM_API vfisyspmError sys_SetTimerCallback( timerNotificationCallback cb );
 659 
 670 VFI_SYS_PM_API vfisyspmError sys_GetRebootReason( std::string & reason );
 671 
 681 VFI_SYS_PM_API vfisyspmError sys_StartSysmode();
 682 
 693 VFI_SYS_PM_API vfisyspmError sys_CriticalSectionList( vfiipc::JSObject &list );
 694 
 706 VFI_SYS_PM_API vfisyspmError sys_GetCurrentState( powermngtState & state );
 707 
 713 VFI_SYS_PM_API const char *sys_GetSvcVersion();
 714 
 720 VFI_SYS_PM_API const char *sys_GetVersion();
 721 
 726 VFI_SYS_PM_API const char * sys_StrError( vfisyspmError error );
 727 
 740 VFI_SYS_PM_API vfisyspmError sys_ResetBatteryFaultState();
 741 
 742 #ifndef DOXYGEN
 743 } // namespace vfisyspm
 744 #endif
 745 
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://sandbox-docs.verifone.com/adk-5.0-programmers-guide/vfisyspm_8h_source.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
