-
Notifications
You must be signed in to change notification settings - Fork 224
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Disable on pre-defined battery level (Issue #24)
- Loading branch information
Showing
10 changed files
with
434 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
// | ||
// KYABatteryStatus.h | ||
// KeepingYouAwake | ||
// | ||
// Created by Marcel Dierkes on 21.12.15. | ||
// Copyright © 2015 Marcel Dierkes. All rights reserved. | ||
// | ||
|
||
#import <Foundation/Foundation.h> | ||
|
||
const CGFloat KYABatteryStatusUnavailable; | ||
|
||
typedef void(^KYABatteryStatusChangeBlock)(CGFloat capacity); | ||
|
||
/** | ||
* An object that represents the current battery capacity. | ||
*/ | ||
@interface KYABatteryStatus : NSObject | ||
|
||
/** | ||
* Returns YES if the current device actually has a built-in battery. | ||
*/ | ||
@property (nonatomic, readonly, getter=isBatteryStatusAvailable) BOOL batteryStatusAvailable; | ||
|
||
/** | ||
* Returns the current battery charging level of the internal battery, or KYABatteryStatusUnavailable. | ||
*/ | ||
@property (nonatomic, readonly) CGFloat currentCapacity; | ||
|
||
/** | ||
* An optional block that will be called when the power source changes and registerForCapacityChanges was called. | ||
*/ | ||
@property (copy, nonatomic, nullable) KYABatteryStatusChangeBlock capacityChangeHandler; | ||
|
||
/** | ||
* Registers the current instance with the runloop to receive power source change notifications. | ||
* | ||
* The capacityChangeHandler block will be called when a power source change occurs. | ||
*/ | ||
- (void)registerForCapacityChangesIfNeeded; | ||
|
||
/** | ||
* Unregisters the current instance from all capacity change notifications. | ||
* This method will automatically be called on dealloc. | ||
*/ | ||
- (void)unregisterFromCapacityChanges; | ||
|
||
@end |
Oops, something went wrong.