本文整理汇总了C++中OSNumber::unsigned32BitValue方法的典型用法代码示例。如果您正苦于以下问题:C++ OSNumber::unsigned32BitValue方法的具体用法?C++ OSNumber::unsigned32BitValue怎么用?C++ OSNumber::unsigned32BitValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OSNumber
的用法示例。
在下文中一共展示了OSNumber::unsigned32BitValue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OSDynamicCast
bool
IOUSBNub::USBComparePropertyWithMask( OSDictionary *matching, const char *key, const char * maskKey )
{
// This routine will return success if the "key" in the dictionary matches the key in the property table
// while applying the "mask" value to both
// First, check to see if we have both keys
//
OSNumber * registryProperty = NULL;
OSNumber * dictionaryProperty = NULL;
OSNumber * dictionaryMask = NULL;
registryProperty = OSDynamicCast(OSNumber, getProperty(key));
dictionaryProperty = OSDynamicCast(OSNumber, matching->getObject(key));
dictionaryMask = OSDynamicCast(OSNumber, matching->getObject(maskKey));
if ( registryProperty && dictionaryProperty && dictionaryMask )
{
// If all our values are OSNumbers, then get their actual value and do the masking
// to see if they are equal
//
UInt32 registryValue = registryProperty->unsigned32BitValue();
UInt32 dictionaryValue = dictionaryProperty->unsigned32BitValue();
UInt32 mask = dictionaryMask->unsigned32BitValue();
if ( (registryValue & mask) == (dictionaryValue & mask) )
{
return true;
}
}
return false;
}
示例2: CompareNumberPropertyMask
bool CompareNumberPropertyMask( IOService *owner, OSDictionary *matching, const char *key, const char *maskKey, SInt32 *score, SInt32 increment)
{
OSNumber * registryProperty;
OSNumber * dictionaryProperty;
OSNumber * valueMask;
registryProperty = OSDynamicCast(OSNumber, owner->getProperty(key));
dictionaryProperty = OSDynamicCast(OSNumber, matching->getObject(key));
valueMask = OSDynamicCast(OSNumber, matching->getObject(maskKey));
// If the dicitonary or value mask doesn't exist then return true
if ( dictionaryProperty && valueMask )
{
if ( registryProperty )
{
// If all our values are OSNumbers, then get their actual value and do the masking
// to see if they are equal
//
UInt32 registryValue = registryProperty->unsigned32BitValue();
UInt32 dictionaryValue = dictionaryProperty->unsigned32BitValue();
UInt32 mask = valueMask->unsigned32BitValue();
if ( (registryValue & mask) == (dictionaryValue & mask) )
{
if ( score )
*score += increment;
return true;
}
}
}
else
return true;
return false;
}
示例3: OSDynamicCast
// Read the settings from the registry
void Xbox360Peripheral::readSettings(void)
{
OSBoolean *value = NULL;
OSNumber *number = NULL;
OSDictionary *dataDictionary = OSDynamicCast(OSDictionary, getProperty(kDriverSettingKey));
if (dataDictionary == NULL) return;
value = OSDynamicCast(OSBoolean, dataDictionary->getObject("InvertLeftX"));
if (value != NULL) invertLeftX = value->getValue();
value = OSDynamicCast(OSBoolean, dataDictionary->getObject("InvertLeftY"));
if (value != NULL) invertLeftY = value->getValue();
value = OSDynamicCast(OSBoolean, dataDictionary->getObject("InvertRightX"));
if (value != NULL) invertRightX = value->getValue();
value = OSDynamicCast(OSBoolean, dataDictionary->getObject("InvertRightY"));
if (value != NULL) invertRightY = value->getValue();
number = OSDynamicCast(OSNumber, dataDictionary->getObject("DeadzoneLeft"));
if (number != NULL) deadzoneLeft = number->unsigned32BitValue();
number = OSDynamicCast(OSNumber, dataDictionary->getObject("DeadzoneRight"));
if (number != NULL) deadzoneRight = number->unsigned32BitValue();
value = OSDynamicCast(OSBoolean, dataDictionary->getObject("RelativeLeft"));
if (value != NULL) relativeLeft = value->getValue();
value = OSDynamicCast(OSBoolean, dataDictionary->getObject("RelativeRight"));
if (value != NULL) relativeRight=value->getValue();
#if 0
IOLog("Xbox360Peripheral preferences loaded:\n invertLeft X: %s, Y: %s\n invertRight X: %s, Y:%s\n deadzone Left: %d, Right: %d\n\n",
invertLeftX?"True":"False",invertLeftY?"True":"False",
invertRightX?"True":"False",invertRightY?"True":"False",
deadzoneLeft,deadzoneRight);
#endif
}
示例4: handleStart
//====================================================================================================
// IOHIDEventOverrideDriver::dispatchKeyboardEvent
//====================================================================================================
bool IOHIDEventOverrideDriver::handleStart( IOService * provider )
{
OSArray * maps = NULL;
if ( !super::handleStart(provider) )
return false;
maps = OSDynamicCast(OSArray, getProperty("ButtonMaps"));
if ( maps ) {
int index;
for ( index=0; index<maps->getCount(); index++ ) {
OSDictionary * map;
OSNumber * number;
uint32_t button;
uint32_t usagePage;
uint32_t usage;
uint32_t eventType;
map = OSDynamicCast(OSDictionary, maps->getObject(index));
if ( !map )
continue;
number = OSDynamicCast(OSNumber, map->getObject("ButtonNumber"));
if ( !number )
continue;
button = number->unsigned32BitValue();
if ( !button || button>32 )
continue;
number = OSDynamicCast(OSNumber, map->getObject("EventType"));
if ( !number )
continue;
eventType = number->unsigned32BitValue();
number = OSDynamicCast(OSNumber, map->getObject("UsagePage"));
if ( !number )
continue;
usagePage = number->unsigned32BitValue();
number = OSDynamicCast(OSNumber, map->getObject("Usage"));
if ( !number )
continue;
usage = number->unsigned32BitValue();
_buttonMap[button-1].eventType = eventType;
_buttonMap[button-1].usagePage = usagePage;
_buttonMap[button-1].usage = usage;
}
}
return true;
}
示例5: setParamProperties
IOReturn ApplePS2SynapticsTouchPad::setParamProperties( OSDictionary * dict )
{
OSNumber * clicking = OSDynamicCast( OSNumber, dict->getObject("Clicking") );
if ( clicking )
{
UInt8 newModeByteValue = clicking->unsigned32BitValue() & 0x1 ?
kModeByteValueGesturesEnabled :
kModeByteValueGesturesDisabled;
if (_touchPadModeByte != newModeByteValue)
{
_touchPadModeByte = newModeByteValue;
//
// Write the TouchPad mode byte value.
//
setTouchPadModeByte(_touchPadModeByte, true);
//
// Advertise the current state of the tapping feature.
//
setProperty("Clicking", clicking);
}
}
return super::setParamProperties(dict);
}
示例6: validateValue
IOReturn IOAudioLevelControl::validateValue(OSObject *newValue)
{
IOReturn result = kIOReturnBadArgument;
OSNumber *number;
number = OSDynamicCast(OSNumber, newValue);
DbgLog("+ IOAudioLevelControl::validateValue[%p] (%p)\n", this, newValue);
if (number) {
SInt32 newIntValue;
newIntValue = (SInt32)number->unsigned32BitValue();
DbgLog(" IOAudioLevelControl::validateValue[%p] - newIntValue = %ld, min = %ld, max = %ld\n", this, (long int)newIntValue, (long int)minValue, (long int)maxValue);
if ((newIntValue >= minValue) && (newIntValue <= maxValue)) {
result = kIOReturnSuccess;
} else {
result = kIOReturnError;
}
}
DbgLog("- IOAudioLevelControl::validateValue[%p] (%p) returns 0x%lX\n", this, newValue, (long unsigned int)result );
return result;
}
示例7: OSDynamicCast
// GetPlistValue
UInt32
VoodooPState::getPlistValue(OSDictionary * dictionary,
const char * symbol)
{
OSObject * object = 0;
OSBoolean * boolean = false;
OSNumber * number = 0;
OSString * string = 0;
object = dictionary->getObject(symbol);
if (object && (OSTypeIDInst(object) == OSTypeID(OSBoolean)))
{
boolean = OSDynamicCast(OSBoolean, object);
return boolean->getValue();
}
if (object && (OSTypeIDInst(object) == OSTypeID(OSNumber)))
{
number = OSDynamicCast(OSNumber, object);
return number->unsigned32BitValue();
}
if (object && (OSTypeIDInst(object) == OSTypeID(OSString)))
{
string = OSDynamicCast(OSString, object);
// Implement string to number conversion
}
return 0;
}
示例8: OSDynamicCast
OSNumber * IOHIDDeviceShim::newLocationIDNumber() const
{
OSNumber * number;
UInt32 location = _location;
if (_device && !location)
{
if ((number = OSDynamicCast(OSNumber, _device->getProperty("locationID"))) ||
(number = OSDynamicCast(OSNumber, _device->getProperty(kIOHIDLocationIDKey))))
{
location = number->unsigned32BitValue();
}
else
{
// Bullshit a location based on the ADB address and handler id
if (number = OSDynamicCast(OSNumber, _device->getProperty("address")))
location |= number->unsigned8BitValue() << 24;
if (number = OSDynamicCast(OSNumber, _device->getProperty("handler id")))
location |= number->unsigned8BitValue() << 16;
}
}
return (location) ? OSNumber::withNumber(location, 32) : 0;
}
示例9: init
bool iTCOWatchdog::init (OSDictionary* dict)
{
OSNumber *nkey;
OSBoolean *bkey;
bool res;
//DbgPrint(drvid, "init\n");
res = super::init(dict);
Timeout = DEFAULT_TIMEOUT;
SelfFeeding = false;
WorkaroundBug = false;
if ((conf = OSDynamicCast(OSDictionary, getProperty("Settings"))) &&
(nkey = OSDynamicCast(OSNumber, conf->getObject("Timeout"))))
Timeout = nkey->unsigned32BitValue();
if (conf && (bkey = OSDynamicCast(OSBoolean, conf->getObject("SelfFeeding"))))
SelfFeeding = bkey->isTrue();
if (conf && (bkey = OSDynamicCast(OSBoolean, conf->getObject("UnsafeWorkaroundBIOSBug"))))
WorkaroundBug = bkey->isTrue();
first_run = true;
is_active = SMIWereEnabled = false;
GCSMem.range = NULL; GCSMem.map = NULL;
lock = IOSimpleLockAlloc();
return res;
}
示例10: valueExists
bool IOAudioSelectorControl::valueExists(SInt32 selectionValue)
{
bool found = false;
OSCollectionIterator *iterator;
assert(availableSelections);
iterator = OSCollectionIterator::withCollection(availableSelections);
if (iterator) {
OSDictionary *selection;
while ( (selection = (OSDictionary *)iterator->getNextObject()) ) {
OSNumber *sValue;
sValue = (OSNumber *)selection->getObject(kIOAudioSelectorControlSelectionValueKey);
if (sValue && ((SInt32)sValue->unsigned32BitValue() == selectionValue)) {
found = true;
break;
}
}
iterator->release();
}
return found;
}
示例11: queryACPICurentBrightnessLevel
UInt32 ACPIBacklightPanel::queryACPICurentBrightnessLevel()
{
//DbgLog("%s::%s()\n", this->getName(),__FUNCTION__);
if (_backlightHandler)
return _backlightHandler->getBacklightLevel();
UInt32 level = minAC;
const char* method = _extended ? "XBQC" : "_BQC";
if (kIOReturnSuccess == backLightDevice->evaluateInteger(method, &level))
{
//DbgLog("%s: queryACPICurentBrightnessLevel %s = %d\n", this->getName(), method, level);
OSBoolean * useIdx = OSDynamicCast(OSBoolean, getProperty("BQC use index"));
if (useIdx && useIdx->isTrue())
{
OSArray * levels = queryACPISupportedBrightnessLevels();
if (levels)
{
OSNumber *num = OSDynamicCast(OSNumber, levels->getObject(level));
if (num)
level = num->unsigned32BitValue();
levels->release();
}
}
//DbgLog("%s: queryACPICurentBrightnessLevel returning %d\n", this->getName(), level);
}
else {
IOLog("ACPIBacklight: Error in queryACPICurentBrightnessLevel %s\n", method);
}
//some laptops didn't return anything on startup, return then max value (first entry in _BCL):
return level;
}
示例12: memcpy
int VoodooI2CHIDDevice::i2c_hid_acpi_pdata(i2c_hid *ihid) {
UInt32 guid_1 = 0x3CDFF6F7;
UInt32 guid_2 = 0x45554267;
UInt32 guid_3 = 0x0AB305AD;
UInt32 guid_4 = 0xDE38893D;
OSObject *result = NULL;
OSObject *params[3];
char buffer[16];
memcpy(buffer, &guid_1, 4);
memcpy(buffer + 4, &guid_2, 4);
memcpy(buffer + 8, &guid_3, 4);
memcpy(buffer + 12, &guid_4, 4);
params[0] = OSData::withBytes(buffer, 16);
params[1] = OSNumber::withNumber(0x1, 8);
params[2] = OSNumber::withNumber(0x1, 8);
ihid->client->provider->evaluateObject("_DSM", &result, params, 3);
OSNumber* number = OSDynamicCast(OSNumber, result);
ihid->pdata.hid_descriptor_address = number->unsigned32BitValue();
number->release();
params[0]->release();
params[1]->release();
params[2]->release();
return 0;
}
示例13: GetOwnerProvider
OSNumber* Xbox360ControllerClass::newLocationIDNumber() const
{
IOUSBDevice *device;
OSNumber *number;
UInt32 location = 0;
device = GetOwnerProvider(this);
if (device)
{
if ((number = OSDynamicCast(OSNumber, device->getProperty("locationID"))))
{
location = number->unsigned32BitValue();
}
else
{
// Make up an address
if ((number = OSDynamicCast(OSNumber, device->getProperty("USB Address"))))
location |= number->unsigned8BitValue() << 24;
if ((number = OSDynamicCast(OSNumber, device->getProperty("idProduct"))))
location |= number->unsigned8BitValue() << 16;
}
}
return (location != 0) ? OSNumber::withNumber(location, 32) : 0;
}
示例14: setParamProperties
IOReturn ApplePS2Mouse::setParamProperties( OSDictionary * config )
{
if (NULL == config)
return 0;
const struct {const char *name; int *var;} int32vars[]={
{"DefaultResolution", &defres},
{"ResolutionMode", &resmode},
{"ScrollResolution", &scrollres},
{"MouseYInverter", &mouseyinverter},
{"WakeDelay", &wakedelay},
};
const struct {const char *name; int *var;} boolvars[]={
{"ForceDefaultResolution", &forceres},
{"ForceSetResolution", &forcesetres},
{"ActLikeTrackpad", &actliketrackpad},
{"DisableLEDUpdating", &noled},
};
const struct {const char* name; bool* var;} lowbitvars[]={
{"TrackpadScroll", &scroll},
{"OutsidezoneNoAction When Typing", &outzone_wt},
{"PalmNoAction Permanent", &palm},
{"PalmNoAction When Typing", &palm_wt},
};
OSNumber *num;
OSBoolean *bl;
// boolean config items
for (int i = 0; i < countof(boolvars); i++)
if ((bl=OSDynamicCast (OSBoolean,config->getObject (boolvars[i].name))))
*boolvars[i].var = bl->isTrue();
// lowbit config items
for (int i = 0; i < countof(lowbitvars); i++)
if ((num=OSDynamicCast (OSNumber,config->getObject(lowbitvars[i].name))))
*lowbitvars[i].var = (num->unsigned32BitValue()&0x1)?true:false;
// 32-bit config items
for (int i = 0; i < countof(int32vars);i++)
if ((num=OSDynamicCast (OSNumber,config->getObject (int32vars[i].name))))
*int32vars[i].var = num->unsigned32BitValue();
// convert to IOFixed format...
defres <<= 16;
return super::setParamProperties(config);
}
示例15: getNumberPropertyValue
UInt32 CLASS::getNumberPropertyValue( const char * propKey ) const
{
OSNumber * num = OSDynamicCast(OSNumber, getProperty(propKey));
if (num)
return num->unsigned32BitValue();
else
return 0;
}