当前位置: 首页>>代码示例>>C++>>正文


C++ OSNumber::unsigned16BitValue方法代码示例

本文整理汇总了C++中OSNumber::unsigned16BitValue方法的典型用法代码示例。如果您正苦于以下问题:C++ OSNumber::unsigned16BitValue方法的具体用法?C++ OSNumber::unsigned16BitValue怎么用?C++ OSNumber::unsigned16BitValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在OSNumber的用法示例。


在下文中一共展示了OSNumber::unsigned16BitValue方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: start

bool SuperIOPlugin::start(IOService *provider)
{	
	if (!super::start(provider)) 
        return false;
    
    OSNumber *number = OSDynamicCast(OSNumber, provider->getProperty(kSuperIOHWMAddress));
    
    if (!number || !(address = number->unsigned16BitValue())) {
        HWSensorsFatalLog("wrong address provided");
        return false;
    }
    
    number = OSDynamicCast(OSNumber, provider->getProperty(kSuperIOControlPort));
    
    if (!number || !(port = number->unsigned8BitValue())) {
        HWSensorsFatalLog("wrong port provided");
        return false;
    }
    
    number = OSDynamicCast(OSNumber, provider->getProperty(kSuperIOModelValue));
    
    if (!number || !(model = number->unsigned16BitValue())) {
        HWSensorsFatalLog("wrong model provided");
        return false;
    }
    
    OSString *string = OSDynamicCast(OSString, provider->getProperty(kSuperIOModelName));
    
    if (!string || !(modelName = string->getCStringNoCopy())) {
        HWSensorsFatalLog("wrong model name provided");
        return false;
    }
    
    string = OSDynamicCast(OSString, provider->getProperty(kSuperIOVendorName));
    
    if (!string || !(vendorName = string->getCStringNoCopy())) {
        HWSensorsFatalLog("wrong vendor name provided");
        return false;
    }
    
    if (!initialize())
        return false;
    
    OSString *modelString = OSString::withCString(modelName);

	if (OSDictionary *configuration = getConfigurationNode(modelString))
    {
        addTemperatureSensors(configuration);
        addVoltageSensors(configuration);
        addTachometerSensors(configuration);
    }
    else HWSensorsWarningLog("no platform profile provided");
    
    OSSafeReleaseNULL(modelString);
    
    registerService();
    
    HWSensorsInfoLog("started");

	return true;
}
开发者ID:alexleigh,项目名称:HWSensors,代码行数:61,代码来源:SuperIOPlugin.cpp

示例2: init

bool com_reidburke_air_IntelEnhancedSpeedStep::init(OSDictionary* dict) {
	bool res = super::init(dict);
	info("Initializing xnu-speedstep-air\n");
  
  // read data
  cpuid_update_generic_info();
  
	/* Allocate our spinlock for later use */
	Lock = IOSimpleLockAlloc();
	/* Check for a patched kernel which properly implements rtc_clock_stepped() */
	uint64_t magic = -1; // means autodetect
	
	OSBoolean* debugMsgs = (OSBoolean*) dict->getObject("DebugMessages");
	if (debugMsgs != 0)
		DebugOn = debugMsgs->getValue();
	else
		DebugOn = false;
	
	OSNumber* kernelFeatures = (OSNumber*) dict->getObject("KernelFeatures");
	if (kernelFeatures != 0)
		magic = kernelFeatures->unsigned8BitValue();
	
	if (magic == 255) nanoseconds_to_absolutetime(~(0), &magic); //255uint = -1 int
	
	if (magic == 1) {
		RtcFixKernel = true;
		Below1Ghz	= false;
	} else if (magic == 2) {
		RtcFixKernel = true;
		Below1Ghz	= true;
	} else if (magic == 3) {
		RtcFixKernel = false;
		Below1Ghz = true;
	} else {
		RtcFixKernel = false;
		Below1Ghz	= false;
	}
	
	checkForNby2Ratio(); // check and store in global variable before loading pstate override
	if (getFSB() == false)
		return false;
	
	OSArray* overrideTable = (OSArray*) dict->getObject("PStateTable");
	if (overrideTable != 0 )
		loadPStateOverride(overrideTable);
	
	OSNumber* defaultState = (OSNumber*) dict->getObject("DefaultPState");
	if (defaultState != 0)
		DefaultPState = defaultState->unsigned8BitValue();
	else
		DefaultPState = -1; // indicate no default state

	OSNumber* maxLatency = (OSNumber*) dict->getObject("Latency");
	if (maxLatency != 0)
		MaxLatency = maxLatency->unsigned32BitValue();
	else
		MaxLatency = 0;
	
 	
  /* Make preliminary check */
	if ( (strcmp(cpuid_info()->cpuid_vendor, CPUID_VID_INTEL) == 0) // Check it's actually Intel
      && ( cpuid_info()->cpuid_features & CPUID_FEATURE_EST) ) { // Check it supports EST
	 
    autostart = (OSNumber*) dict->getObject("AutoStart");
    info( "do autostart %d \n", autostart->unsigned8BitValue() );
    
    if ( autostart != 0 && autostart->unsigned8BitValue() == 1 ) {
      Throttler = new AutoThrottler;
      if (Throttler) {
        dbg("Throttler instantiated.\n");
        OSNumber* targetload = (OSNumber*) dict->getObject("TargetCPULoad");
        if (targetload != 0)
          Throttler->targetCPULoad = (targetload->unsigned16BitValue()) * 10;
        else
          Throttler->targetCPULoad = 700;
      }
    }
	}
  
	totalThrottles = 0;
	frequencyUsage[0] = '\0';
	
	/* Return whatever the superclass returned */
	return res;
}
开发者ID:Knoflook,项目名称:xnu-speedstep-air,代码行数:85,代码来源:IntelEnhancedSpeedStep.cpp

示例3: start

bool SuperIOMonitor::start(IOService *provider)
{	
	if (!super::start(provider)) 
        return false;
    
    OSNumber *number = OSDynamicCast(OSNumber, provider->getProperty(kSuperIOHWMAddress));
    
    if (!number || !(address = number->unsigned16BitValue())) {
        HWSensorsWarningLog("wrong address provided");
        return false;
    }
    
    number = OSDynamicCast(OSNumber, provider->getProperty(kSuperIOControlPort));
    
    if (!number || !(port = number->unsigned8BitValue())) {
        HWSensorsWarningLog("wrong port provided");
        return false;
    }
    
    number = OSDynamicCast(OSNumber, provider->getProperty(kSuperIOModelValue));
    
    if (!number || !(model = number->unsigned16BitValue())) {
        HWSensorsWarningLog("wrong model provided");
        return false;
    }
    
    OSString *string = OSDynamicCast(OSString, provider->getProperty(kSuperIOModelName));
    
    if (!string || !(modelName = string->getCStringNoCopy())) {
        HWSensorsWarningLog("wrong model name provided");
        return false;
    }
    
    string = OSDynamicCast(OSString, provider->getProperty(kSuperIOVendorName));
    
    if (!string || !(vendorName = string->getCStringNoCopy())) {
        HWSensorsWarningLog("wrong vendor name provided");
        return false;
    }
    
    if (!initialize())
        return false;

    OSString *manufacturerName = OSDynamicCast(OSString, provider->getProperty("mb-manufacturer"));
    OSString *productName = OSDynamicCast(OSString, provider->getProperty("mb-product"));
    
    OSDictionary *configuration = NULL;
    
    if (OSDictionary *list = OSDynamicCast(OSDictionary, getProperty("Sensors Configuration")))
    {
        if (OSDictionary *manufacturer = OSDynamicCast(OSDictionary, list->getObject(manufacturerName)))
            if (!(configuration = lookupConfiguration(manufacturer, productName)))
                if (!(configuration = lookupConfiguration(manufacturer, modelName)))
                    configuration = lookupConfiguration(manufacturer, "Default");
        
        if (!configuration && !(configuration = lookupConfiguration(list, modelName)))
            configuration = lookupConfiguration(list, "Default");
    }

	if (configuration) {    
        addTemperatureSensors(configuration);
        addVoltageSensors(configuration);
        addTachometerSensors(configuration);
        registerService();
    }
    else HWSensorsWarningLog("no sensors configuration provided");
    
    HWSensorsInfoLog("started");

	return true;
}
开发者ID:macwill,项目名称:HWSensors,代码行数:71,代码来源:SuperIOMonitor.cpp


注:本文中的OSNumber::unsigned16BitValue方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。