libkeepalive
Loading...
Searching...
No Matches
keepalive-cpukeepalive.h File Reference

Provides wrapper API for MCE CPU-keepalive D-Bus interface. More...

Go to the source code of this file.

Typedefs

typedef struct cpukeepalive_t cpukeepalive_t
 

Functions

cpukeepalive_tcpukeepalive_new (void)
 
cpukeepalive_tcpukeepalive_ref (cpukeepalive_t *self)
 
void cpukeepalive_unref (cpukeepalive_t *self)
 
void cpukeepalive_start (cpukeepalive_t *self)
 
void cpukeepalive_stop (cpukeepalive_t *self)
 
const char * cpukeepalive_get_id (const cpukeepalive_t *self)
 

Detailed Description

Provides wrapper API for MCE CPU-keepalive D-Bus interface.

Typedef Documentation

◆ cpukeepalive_t

Opaque CPU-keepalive structure

Allocate via cpukeepalive_new() and release via cpukeepalive_unref().

Function Documentation

◆ cpukeepalive_new()

cpukeepalive_t * cpukeepalive_new ( void )

Create CPU-keepalive object

Initially has reference count of 1.

Use cpukeepalive_ref() to increment reference count and cpukeepalive_unref() to decrement reference count.

Will be automatically released after reference count drops to zero.

Returns
pointer to CPU-keepalive object, or NULL
Examples
block-suspend.c.

◆ cpukeepalive_ref()

cpukeepalive_t * cpukeepalive_ref ( cpukeepalive_t * self)

Increment reference count of CPU-keepalive object

Passing NULL object is explicitly allowed and does nothing.

Parameters
selfCPU-keepalive object
Returns
pointer to CPU-keepalive object, or NULL in case of errors

◆ cpukeepalive_unref()

void cpukeepalive_unref ( cpukeepalive_t * self)

Decrement reference count of CPU-keepalive object

Passing NULL object is explicitly allowed and does nothing.

Parameters
selfCPU-keepalive object

The object will be released if reference count reaches zero.

Examples
block-suspend.c.

◆ cpukeepalive_start()

void cpukeepalive_start ( cpukeepalive_t * self)

Disable normal device suspend policy

The CPU-keepalive object makes the necessary D-Bus IPC that keeps the device from suspending while/when the following conditions are met: 1) MCE is running

Parameters
selfCPU-keepalive object
Examples
block-suspend.c.

◆ cpukeepalive_stop()

void cpukeepalive_stop ( cpukeepalive_t * self)

Enable normal device suspend policy

Parameters
selfCPU-keepalive object
Examples
block-suspend.c.

◆ cpukeepalive_get_id()

const char * cpukeepalive_get_id ( const cpukeepalive_t * self)

Get keepalive id string

Normally the id string is used to identify CPU-keepalive object when making D-Bus IPC with MCE, but can be also used if application code needs to have some unique within the process key string to associate with the CPU-keepalive object.

Parameters
selfCPU-keepalive object
Returns
id string