GSCapability is a group of C functions that checks the capability of the device. A capability can be a simple boolean value, e.g. whether the device can take pictures, to a complex structure e.g. the screen dimensions.
Example code
if (GSSystemHasCapability(kGSMagnetometerCapability)) {
direction = get_direction();
} else {
printf("This device has no compass\n");
}