blob: f1e55b2f97d02e4857472eba3f202dd39980f317 [file] [log] [blame]
// Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
syntax = "proto2";
option optimize_for = LITE_RUNTIME;
package power_manager;
// Included in powerm's SuspendStateChanged signal, sent when the system is
// suspending or has just resumed. The SUSPEND_TO_MEMORY notification may
// arrive after the subsequent resume.
message SuspendState {
// Next ID to use: 3
// Type of event.
enum Type {
SUSPEND_TO_MEMORY = 0;
RESUME = 1;
}
optional Type type = 1;
// Wall time at which this event occurred, as given by
// base::Time::ToInternalValue(). (base::Time is used because the monotonic
// clock used by base::TimeTicks doesn't advance while the system is
// suspended.)
optional int64 wall_time = 2;
}
// Included in powerd's SuspendImminent signal, sent when the system is about to
// suspend. If any clients previously called RegisterSuspendDelay, suspending
// will be deferred until they've called powerd's HandleSuspendReadiness method.
//
// The general flow is as follows:
//
// 1. A client that needs to perform some work before the system can be
// suspended listens for SuspendImminent messages from powerd.
// 2. The client passes a RegisterSuspendDelayRequest to powerd's
// RegisterSuspendDelay method and receives a RegisterSuspendDelayReply in
// response. The client saves the |delay_id| field from the response.
// 3. When the power manager is about to suspend the system, it emits a
// SuspendImminent signal containing this message.
// 4. Upon receipt of the signal, the client performs any last minute work
// that it needs to do and then calls powerd's HandleSuspendReadiness,
// including its client ID and the |suspend_id| field from the signal.
// 5. Once powerd has received notification that all registered clients are
// ready to suspend, the system will be suspended.
// 6. Before the client exits, it calls UnregisterSuspendDelayRequest with its
// delay ID.
message SuspendImminent {
// Next ID to use: 2
// Unique ID corresponding to this suspend attempt. This is included in the
// SuspendReadinessInfo message passed via HandleSuspendReadiness.
optional int32 suspend_id = 1;
}
// Included in calls to powerd's RegisterSuspendDelay method.
message RegisterSuspendDelayRequest {
// Next ID to use: 2
// Upper bound on the amount of time that the power manager will wait for this
// client to call HandleSuspendReadiness before suspending the system, as
// given by base::TimeDelta::ToInternalValue().
optional int64 timeout = 1;
}
// Included in responses to powerd's RegisterSuspendDelay method.
message RegisterSuspendDelayReply {
// Next ID to use: 2
// Unique ID assigned to the client that registered this suspend delay. This
// is included in later HandleSuspendReadiness and UnregisterSuspendDelay
// calls.
optional int32 delay_id = 1;
}
// Included in calls to powerd's UnregisterSuspendDelay method.
message UnregisterSuspendDelayRequest {
// Next ID to use: 2
// ID that was returned in response to the original RegisterSuspendDelay call.
optional int32 delay_id = 1;
}
// Included in calls to powerd's HandleSuspendReadiness method.
message SuspendReadinessInfo {
// Next ID to use: 3
// ID that was returned to the client in response to its invocation of
// RegisterSuspendDelay.
optional int32 delay_id = 1;
// ID that was included in the SuspendImminent signal that provoked this
// readiness call.
optional int32 suspend_id = 2;
}