Questions tagged [power-state]

The power state of a device encapsulates what that devices’ power budget is, and what it is currently doing with this power. It is often internally represented by one or more finite-state machine abstractions.

For example, a typical USB Type-C Power Delivery battery charger usually has a single state machine, whose nodes and edges correspond to states defined in the Power Delivery spec. A laptop, which can potentially draw power from at least one source and may provide it for a number of others, can have a variety of power states, potentially encompassing more than one finite-state machine. Devices like USB hubs and Power-over-Ethernet (PoE) network switches may have a power state across the whole device, or an array of per-port independent power states, a hybrid approach, or a novel representation of its state.

For further reading, have a look at the tag.

16 questions
9
votes
1 answer

Detecting the device being plugged in

I would like to be able to detect whether or not the device is plugged in. I would like to be able to just query that the same way we can do for the connectivity state. Is that possible or do I need to create a broadcast receiver that listens for…
CaseyB
  • 24,780
  • 14
  • 77
  • 112
7
votes
4 answers

What is the proper way to have a Windows service stop and start gracefully when suspending/resuming a PC?

I need to stop our Windows service when a PC is powered down into Suspend mode and restart it when the PC is resumed again. What is the proper way to do this?
codewario
  • 19,553
  • 20
  • 90
  • 159
5
votes
1 answer

How to find out if hibernation is available for a Windows user (with C++)

I know that one can call the following API to hibernate the system: SetSuspendState(TRUE, FALSE, FALSE); But is there any way to find out if "real" hibernation is available for the current Windows user? Here's what I mean: If an admin…
ahmd0
  • 16,633
  • 33
  • 137
  • 233
5
votes
2 answers

Detect system standby/sleep/hibernate from .NET Windows Service?

In a Windows Service, I need to detect when the computer goes into sleep and when it wakes up, and run some code on these events. This needs to be done for sleep, standby and hibernate power modes. How do I do that ?
driis
  • 161,458
  • 45
  • 265
  • 341
3
votes
1 answer

Calling PowerStatus.BatteryChargeStatus.ToString() sometimes returns 0

So my method is as follows: PowerStatus powerStatus = SystemInformation.PowerStatus; if (powerStatus.BatteryChargeStatus != BatteryChargeStatus.NoSystemBattery) { var batteryStatus = powerStatus.BatteryChargeStatus.ToString() } From my test…
JKennedy
  • 18,150
  • 17
  • 114
  • 198
3
votes
1 answer

PowerRegisterSuspendResumeNotification - provided callback function doesn't work as expected

I register my application to receive notification when the system is suspended or resumed. MSDN documentation Function I'd like to be executed after application receives notification (I tried both void and void CALLBACK and both work same…
dizzer
  • 106
  • 1
  • 6
2
votes
2 answers

Get Azure VM PowerState in C#/dotnet using Azure.ResourceManager

I want to get the PowerState (on/off/restarting, etc.) of a known Azure VM instance in a C#/dotnet application using Azure.ResourceManager (not PowerShell, not CLI, not REST, not using any deprecated Fluent approach). I can do it successfully with…
cjr
  • 25
  • 6
2
votes
2 answers

Detecting screen monitor Power State change in c++

I have a Windows message loop. I need to detect when the screen powers back up. Is there a windows message? detect power state change contains the C# way, I need the C++ way, using win32 API. If there isn't a Windows message, how do I poll for…
unixman83
  • 9,421
  • 10
  • 68
  • 102
2
votes
1 answer

How to get SYSTEM_POWER_STATUS using Silverlight 2/3/4?

I have a Silverlight application running full screen. Is there a way i can display system power status ( basically battery indicator how much is remaining ? ) using silverlight? I tried following [DllImport("kernel32.dll")] private static extern…
bugBurger
  • 6,950
  • 9
  • 32
  • 39
2
votes
1 answer

Find system power state using C++

I am writing c++ code. I am new to c++. I want to find system power state i.e if its offline/sleep/online etc i am trying to use SYSTEM_POWER_STATE enumeration . But can't find how to use it if some can write a short example or post a helpful link…
Ann
  • 23
  • 1
  • 5
1
vote
1 answer

Power Plan Changing Event beetwen High Performance, Power Saver and Balanced

I'm trying to figure out, how to get Event of Power Plan Changing between High Performance, Power Saver and Balanced, I need it to change my app with different mode for each plan. I found some solutions on this direction, but does not get desired…
user7033723
0
votes
1 answer

Remotely get power state of a pc (like LogMeIn)

on a device (iphone, mac, pc, etc.) i want to know if a pc (on the same lan and running windows) is 1) "on" (meaning powered on) and lan-connected with my device 2) on but the network cable is unplugged or the network card is disabled 3)…
0
votes
2 answers

How to keep wifi link up when an embedded linux device suspends to RAM

Environment: I have an embedded linux system running with an ARM based iMX7 processor. It runs on a build from yocto linux which is very much based on Fedora. Scenario: My system uses Suspend To RAM feature which is linux system power saving mode…
TheWaterProgrammer
  • 7,055
  • 12
  • 70
  • 159
0
votes
2 answers

VMWare PowerCLI Get DiskUsage of powered off vm's

I'm creating a script that gets all vm's and shows the DiskSpace. THe Problem is, that if a vm is powered off, it won't show the uesed Space of a disk. Here are two examples: First one with an VM that is powered on: PowerCLI C:\> Get-VM…
Paasi
  • 33
  • 1
  • 5
0
votes
1 answer

Service exe does not receive power events

I have created a service exe that will autourun at boot. I am using this example to create the service: http://www.cromis.net/blog/2011/04/how-to-make-a-very-small-windows-service-executable/ Works pretty well. The service needs to 'monitor' the…
Codebeat
  • 6,501
  • 6
  • 57
  • 99
1
2