+
+/*******************************************************************************
+ *
+ * PUBLIC Accessors. All the getters! Boo!
+ *
+ ******************************************************************************/
+
+OSObject *
+IOPMPowerSource::getPSProperty(const OSSymbol *symmie)
+{
+ if (!symmie) {
+ return NULL;
+ }
+ return properties->getObject(symmie);
+}
+
+bool
+IOPMPowerSource::externalConnected(void)
+{
+ return kOSBooleanTrue == properties->getObject(externalConnectedKey);
+}
+
+bool
+IOPMPowerSource::externalChargeCapable(void)
+{
+ return kOSBooleanTrue == properties->getObject(externalChargeCapableKey);
+}
+
+bool
+IOPMPowerSource::batteryInstalled(void)
+{
+ return kOSBooleanTrue == properties->getObject(batteryInstalledKey);
+}
+
+bool
+IOPMPowerSource::isCharging(void)
+{
+ return kOSBooleanTrue == properties->getObject(chargingKey);
+}
+
+bool
+IOPMPowerSource::atWarnLevel(void)
+{
+ return kOSBooleanTrue == properties->getObject(warnLevelKey);
+}
+
+bool
+IOPMPowerSource::atCriticalLevel(void)
+{
+ return kOSBooleanTrue == properties->getObject(criticalLevelKey);
+}
+
+unsigned int
+IOPMPowerSource::currentCapacity(void)
+{
+ OSNumber *n;
+ n = OSDynamicCast(OSNumber, properties->getObject(currentCapacityKey));
+ if (!n) {
+ return 0;
+ } else {
+ return (unsigned int)n->unsigned32BitValue();
+ }
+}
+
+unsigned int
+IOPMPowerSource::maxCapacity(void)
+{
+ OSNumber *n;
+ n = OSDynamicCast(OSNumber, properties->getObject(maxCapacityKey));
+ if (!n) {
+ return 0;
+ } else {
+ return (unsigned int)n->unsigned32BitValue();
+ }
+}
+
+unsigned int
+IOPMPowerSource::capacityPercentRemaining(void)
+{
+ unsigned int _currentCapacity = currentCapacity();
+ unsigned int _maxCapacity = maxCapacity();
+ if (0 == _maxCapacity) {
+ return 0;
+ } else {
+ return (100 * _currentCapacity) / _maxCapacity;
+ }
+}
+
+int
+IOPMPowerSource::timeRemaining(void)
+{
+ OSNumber *n;
+ n = OSDynamicCast(OSNumber, properties->getObject(timeRemainingKey));
+ if (!n) {
+ return 0;
+ } else {
+ return (int)n->unsigned32BitValue();
+ }
+}
+
+int
+IOPMPowerSource::amperage(void)
+{
+ OSNumber *n;
+ n = OSDynamicCast(OSNumber, properties->getObject(amperageKey));
+ if (!n) {
+ return 0;
+ } else {
+ return (int)n->unsigned32BitValue();
+ }
+}
+
+unsigned int
+IOPMPowerSource::voltage(void)
+{
+ OSNumber *n;
+ n = OSDynamicCast(OSNumber, properties->getObject(voltageKey));
+ if (!n) {
+ return 0;
+ } else {
+ return (unsigned int)n->unsigned32BitValue();
+ }
+}
+
+unsigned int
+IOPMPowerSource::cycleCount(void)
+{
+ OSNumber *n;
+ n = OSDynamicCast(OSNumber, properties->getObject(cycleCountKey));
+ if (!n) {
+ return 0;
+ } else {
+ return (unsigned int)n->unsigned32BitValue();
+ }
+}
+
+int
+IOPMPowerSource::adapterInfo(void)
+{
+ OSNumber *n;
+ n = OSDynamicCast(OSNumber, properties->getObject(adapterInfoKey));
+ if (!n) {
+ return 0;
+ } else {
+ return (int)n->unsigned32BitValue();
+ }
+}
+
+int
+IOPMPowerSource::location(void)
+{
+ OSNumber *n;
+ n = OSDynamicCast(OSNumber, properties->getObject(locationKey));
+ if (!n) {
+ return 0;
+ } else {
+ return (unsigned int)n->unsigned32BitValue();
+ }
+}
+
+OSSymbol *
+IOPMPowerSource::errorCondition(void)
+{
+ return OSDynamicCast(OSSymbol, properties->getObject(errorConditionKey));
+}
+
+OSSymbol *
+IOPMPowerSource::manufacturer(void)
+{
+ return OSDynamicCast(OSSymbol, properties->getObject(manufacturerKey));
+}
+
+OSSymbol *
+IOPMPowerSource::model(void)
+{
+ return OSDynamicCast(OSSymbol, properties->getObject(modelKey));
+}
+
+OSSymbol *
+IOPMPowerSource::serial(void)
+{
+ return OSDynamicCast(OSSymbol, properties->getObject(serialKey));
+}
+
+OSDictionary *
+IOPMPowerSource::legacyIOBatteryInfo(void)
+{
+ return OSDynamicCast(OSDictionary, properties->getObject(batteryInfoKey));
+}