Documentation
¶
Overview ¶
Package powersources provides a fluent Go API over the macOS PowerSources framework.
Construction ¶
New… functions create objects; each With… method sets one property and returns its receiver, so configuration calls chain. A <Type>FromID constructor adopts an Objective-C object obtained elsewhere.
Lifecycle ¶
A wrapper releases its Objective-C object automatically once the garbage collector finds it unreachable. Call Release to relinquish the reference deterministically (for objects holding scarce resources); Release is idempotent, and afterwards the wrapper's methods are no-ops returning zero values.
Index ¶
- func IOPSCopyExternalPowerAdapterDetails() corefoundation.CFDictionaryRef
- func IOPSCopyPowerSourcesInfo() obj.Object
- func IOPSCopyPowerSourcesList(blob obj.Object) corefoundation.CFArrayRef
- func IOPSCreateLimitedPowerNotification(callback unsafe.Pointer, context_ unsafe.Pointer) corefoundation.CFRunLoopSourceRef
- func IOPSGetPowerSourceDescription(blob obj.Object, ps obj.Object) corefoundation.CFDictionaryRef
- func IOPSGetProvidingPowerSourceType(snapshot obj.Object) corefoundation.CFStringRef
- func IOPSGetTimeRemainingEstimate() float64
- func IOPSNotificationCreateRunLoopSource(callback unsafe.Pointer, context_ unsafe.Pointer) corefoundation.CFRunLoopSourceRef
- type Clockid
- type DispatchAutoreleaseFrequency
- type DispatchBlockFlags
- type EntryID
- type FilesecProperty
- type Flag
- type IOPSLowBatteryWarningLevel
- type Idtype
- type MpoFlags
- type OSClockid
- type Perm
- type PtrauthKey
- type QosClass
- type Tag
- type Type
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IOPSCopyExternalPowerAdapterDetails ¶
func IOPSCopyExternalPowerAdapterDetails() corefoundation.CFDictionaryRef
IOPSCopyExternalPowerAdapterDetails calls the PowerSources framework function IOPSCopyExternalPowerAdapterDetails.
func IOPSCopyPowerSourcesInfo ¶
IOPSCopyPowerSourcesInfo calls the PowerSources framework function IOPSCopyPowerSourcesInfo.
func IOPSCopyPowerSourcesList ¶
func IOPSCopyPowerSourcesList(blob obj.Object) corefoundation.CFArrayRef
IOPSCopyPowerSourcesList calls the PowerSources framework function IOPSCopyPowerSourcesList.
func IOPSCreateLimitedPowerNotification ¶
func IOPSCreateLimitedPowerNotification(callback unsafe.Pointer, context_ unsafe.Pointer) corefoundation.CFRunLoopSourceRef
IOPSCreateLimitedPowerNotification calls the PowerSources framework function IOPSCreateLimitedPowerNotification.
func IOPSGetPowerSourceDescription ¶
func IOPSGetPowerSourceDescription(blob obj.Object, ps obj.Object) corefoundation.CFDictionaryRef
IOPSGetPowerSourceDescription calls the PowerSources framework function IOPSGetPowerSourceDescription.
func IOPSGetProvidingPowerSourceType ¶
func IOPSGetProvidingPowerSourceType(snapshot obj.Object) corefoundation.CFStringRef
IOPSGetProvidingPowerSourceType calls the PowerSources framework function IOPSGetProvidingPowerSourceType.
func IOPSGetTimeRemainingEstimate ¶
func IOPSGetTimeRemainingEstimate() float64
IOPSGetTimeRemainingEstimate calls the PowerSources framework function IOPSGetTimeRemainingEstimate.
func IOPSNotificationCreateRunLoopSource ¶
func IOPSNotificationCreateRunLoopSource(callback unsafe.Pointer, context_ unsafe.Pointer) corefoundation.CFRunLoopSourceRef
IOPSNotificationCreateRunLoopSource calls the PowerSources framework function IOPSNotificationCreateRunLoopSource.
Types ¶
type DispatchAutoreleaseFrequency ¶ added in v0.17.0
type DispatchAutoreleaseFrequency uint64
const ( DispatchAutoreleaseFrequencyInherit DispatchAutoreleaseFrequency = 0 DispatchAutoreleaseFrequencyWorkItem DispatchAutoreleaseFrequency = 1 DispatchAutoreleaseFrequencyNever DispatchAutoreleaseFrequency = 2 )
func (DispatchAutoreleaseFrequency) String ¶ added in v0.17.0
func (e DispatchAutoreleaseFrequency) String() string
String returns the DispatchAutoreleaseFrequency constant's name, or its numeric form when the value is not a known constant.
type DispatchBlockFlags ¶ added in v0.17.0
type DispatchBlockFlags uint64
Bitmask — values may be combined with |.
const ( DispatchBlockFlagsBarrier DispatchBlockFlags = 1 DispatchBlockFlagsDetached DispatchBlockFlags = 2 DispatchBlockFlagsAssignCurrent DispatchBlockFlags = 4 DispatchBlockFlagsNoQosClass DispatchBlockFlags = 8 DispatchBlockFlagsInheritQosClass DispatchBlockFlags = 16 DispatchBlockFlagsEnforceQosClass DispatchBlockFlags = 32 )
func (DispatchBlockFlags) String ¶ added in v0.17.0
func (e DispatchBlockFlags) String() string
String returns the DispatchBlockFlags constant's name, or its numeric form when the value is not a known constant.
type FilesecProperty ¶ added in v0.17.0
type FilesecProperty int64
const ( FilesecPropertyOwner FilesecProperty = 1 FilesecPropertyGroup FilesecProperty = 2 FilesecPropertyUUID FilesecProperty = 3 FilesecPropertyMode FilesecProperty = 4 FilesecPropertyACL FilesecProperty = 5 FilesecPropertyGrpuuid FilesecProperty = 6 FilesecPropertyACLRaw FilesecProperty = 100 FilesecPropertyACLAllocsize FilesecProperty = 101 )
func (FilesecProperty) String ¶ added in v0.17.0
func (e FilesecProperty) String() string
String returns the FilesecProperty constant's name, or its numeric form when the value is not a known constant.
type IOPSLowBatteryWarningLevel ¶
type IOPSLowBatteryWarningLevel int64
Possible return values from <code>
const ( // The system is not in a low battery situation, or is on drawing from an external power source. The system displays no low power warnings; neither should application clients of this API. KIOPSLowBatteryWarningNone IOPSLowBatteryWarningLevel = 1 // The battery can provide no more than 20 minutes of runtime. OS X makes no guarantees that the system shall remain in Early Warning for 20 minutes. Batteries are frequently calibrated differently and may provide runtime for more, or less, than the estimated 20 minutes. OS X alerts the user by changing the color of BatteryMonitor to red. Warning the user is optional for full screen apps. KIOPSLowBatteryWarningEarly IOPSLowBatteryWarningLevel = 2 // The battery can provide no more than 10 minutes of runtime. OS X makes no guarantees that the system shall remain in Final Warning for 10 minutes. Batteries are frequently calibrated differently and may provide runtime for more, or less, than the estimated 10 minutes. KIOPSLowBatteryWarningFinal IOPSLowBatteryWarningLevel = 3 )
func IOPSGetBatteryWarningLevel ¶
func IOPSGetBatteryWarningLevel() IOPSLowBatteryWarningLevel
IOPSGetBatteryWarningLevel calls the PowerSources framework function IOPSGetBatteryWarningLevel.
func (IOPSLowBatteryWarningLevel) String ¶
func (e IOPSLowBatteryWarningLevel) String() string
String returns the IOPSLowBatteryWarningLevel constant's name, or its numeric form when the value is not a known constant.
type MpoFlags ¶ added in v0.17.0
type MpoFlags int64
Bitmask — values may be combined with |.
const ( MpoFlagsPort MpoFlags = 0 MpoFlagsServicePort MpoFlags = 1024 MpoFlagsConnectionPort MpoFlags = 2048 MpoFlagsReplyPort MpoFlags = 4096 MpoFlagsWeakReplyPort MpoFlags = 16384 MpoFlagsNotificationPort MpoFlags = 17408 MpoFlagsExceptionPort MpoFlags = 32768 MpoFlagsConnectionPortWithPortArray MpoFlags = 65536 )
type Perm ¶ added in v0.17.0
type Perm int64
const ( PermReadData Perm = 2 PermListDirectory Perm = 2 PermWriteData Perm = 4 PermAddFile Perm = 4 PermExecute Perm = 8 PermSearch Perm = 8 PermDelete Perm = 16 PermAppendData Perm = 32 PermAddSubdirectory Perm = 32 PermDeleteChild Perm = 64 PermReadAttributes Perm = 128 PermWriteAttributes Perm = 256 PermReadExtattributes Perm = 512 PermWriteExtattributes Perm = 1024 PermReadSecurity Perm = 2048 PermWriteSecurity Perm = 4096 PermChangeOwner Perm = 8192 PermSynchronize Perm = 1048576 )
type PtrauthKey ¶ added in v0.17.0
type PtrauthKey int64
const ( Ptrauth_key_none PtrauthKey = -1 Ptrauth_key_asia PtrauthKey = 0 Ptrauth_key_asib PtrauthKey = 1 Ptrauth_key_asda PtrauthKey = 2 Ptrauth_key_asdb PtrauthKey = 3 Ptrauth_key_process_independent_code PtrauthKey = 0 Ptrauth_key_process_dependent_code PtrauthKey = 1 Ptrauth_key_process_independent_data PtrauthKey = 2 Ptrauth_key_process_dependent_data PtrauthKey = 3 Ptrauth_key_return_address PtrauthKey = 1 Ptrauth_key_frame_pointer PtrauthKey = 3 Ptrauth_key_function_pointer PtrauthKey = 0 Ptrauth_key_block_function PtrauthKey = 0 Ptrauth_key_cxx_vtable_pointer PtrauthKey = 2 Ptrauth_key_method_list_pointer PtrauthKey = 2 Ptrauth_key_objc_isa_pointer PtrauthKey = 2 Ptrauth_key_objc_super_pointer PtrauthKey = 2 Ptrauth_key_objc_sel_pointer PtrauthKey = 3 Ptrauth_key_objc_class_ro_pointer PtrauthKey = 2 Ptrauth_key_block_descriptor_pointer PtrauthKey = 2 Ptrauth_key_init_fini_pointer PtrauthKey = 0 )
func (PtrauthKey) String ¶ added in v0.17.0
func (e PtrauthKey) String() string
String returns the PtrauthKey constant's name, or its numeric form when the value is not a known constant.