Recent

Author Topic: Battery Operations  (Read 835 times)

msintle

  • Jr. Member
  • **
  • Posts: 83
Battery Operations
« on: December 06, 2023, 02:56:45 pm »
On macOS, is there a way, while the device is physically plugged-in to power:

1. Read the current battery charge
2. Set a maximum charging limit
3. Allow the battery to discharge, when it is above the set maximum charging limit

Ideally all directly within Lazarus, without having to use command line tools (if possible at all)?

I figure the hardest would be #3 above?

Hansaplast

  • Hero Member
  • *****
  • Posts: 674
  • Tweaking4All.com
    • Tweaking4All
Re: Battery Operations
« Reply #1 on: December 06, 2023, 04:26:54 pm »
Never used it, but you may want to look at the IOPowerSources API ...

The header file can be found on your Mac. I found it here on my Mac:
Code: [Select]
/Library/Developer/CommandLineTools/SDKs/MacOSX14.0.sdk/System/Library/Frameworks/IOKit.framework/Versions/A/Headers/psNot sure if anyone has converted it to Lazarus Pascal yet though.

msintle

  • Jr. Member
  • **
  • Posts: 83
Re: Battery Operations
« Reply #2 on: December 08, 2023, 11:24:55 pm »
This looks like the exact API I need:

https://github.com/mhaeuser/Battery-Toolkit

Any thoughts on how to access it via Lazarus?

msintle

  • Jr. Member
  • **
  • Posts: 83
Re: Battery Operations
« Reply #3 on: December 09, 2023, 02:07:31 am »
Here's a job post for the so inclined:

https://www.upwork.com/jobs/~0116061a05654cb78e

 

TinyPortal © 2005-2018