コード例 #1
0
void AppleACPIBatteryDevice::rebuildLegacyIOBatteryInfo(void)
{
    OSDictionary        *legacyDict = OSDictionary::withCapacity(5);
    uint32_t            flags = 0;
    OSNumber            *flags_num = NULL;
	
    if (externalConnected()) flags |= kIOPMACInstalled;
    if (batteryInstalled()) flags |= kIOPMBatteryInstalled;
    if (isCharging()) flags |= kIOPMBatteryCharging;
	
    flags_num = OSNumber::withNumber((unsigned long long)flags, NUM_BITS);
    legacyDict->setObject(kIOBatteryFlagsKey, flags_num);
    flags_num->release();
	
    legacyDict->setObject(kIOBatteryCurrentChargeKey, properties->getObject(kIOPMPSCurrentCapacityKey));
    legacyDict->setObject(kIOBatteryCapacityKey, properties->getObject(kIOPMPSMaxCapacityKey));
    legacyDict->setObject(kIOBatteryVoltageKey, properties->getObject(kIOPMPSVoltageKey));
    legacyDict->setObject(kIOBatteryAmperageKey, properties->getObject(kIOPMPSAmperageKey));
    legacyDict->setObject(kIOBatteryCycleCountKey, properties->getObject(kIOPMPSCycleCountKey));
	
    setLegacyIOBatteryInfo(legacyDict);
	
    legacyDict->release();
}
コード例 #2
0
void ConnectionParameters::setExternalComunicator(ExternalConnector * comunicator)
{
    m_connector = comunicator;
    connect(m_connector, SIGNAL(connectionEstablished()), this, SLOT(externalConnected()));
    connect(m_connector, SIGNAL(connectionBroken()), this, SLOT(externalDisconnected()));
}