Created
October 21, 2014 08:29
-
-
Save annidy/7ebd4932dc1f1718ab71 to your computer and use it in GitHub Desktop.
获取信号强度方法
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int GetSignalStrength() | |
{ | |
static int (*CTGetSignalStrength)() = GetSignalStrength; | |
if (CTGetSignalStrength == GetSignalStrength) { | |
void *libHandle = dlopen("/System/Library/Frameworks/CoreTelephony.framework/CoreTelephony", RTLD_LAZY); | |
CTGetSignalStrength = dlsym(libHandle, "CTGetSignalStrength"); | |
dlclose(libHandle); | |
} | |
if( CTGetSignalStrength == NULL) { | |
return -1; | |
} | |
return CTGetSignalStrength(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment