get carrier name and signal strength return wrong value in iphone
Asked Answered
G

2

1

i curious why i get wrong value to get carrier name and signal strength. Here the code.

CTTelephonyNetworkInfo *netinfo = [[CTTelephonyNetworkInfo alloc] init];
CTCarrier *car = [netinfo subscriberCellularProvider];
NSLog(@"Carrier Name: %@", car.carrierName);
[netinfo release];

Why i get value "carrier" instead of carrier i use?

this is code to get signal strength

void *libHandle = dlopen("/System/Library/Frameworks/CoreTelephony.framework/CoreTelephony", RTLD_LAZY);
int (*CTGetSignalStrength)();
CTGetSignalStrength = dlsym(libHandle, "CTGetSignalStrength");
if( CTGetSignalStrength == NULL) NSLog(@"Could not find CTGetSignalStrength");  
int result = CTGetSignalStrength();
NSLog(@"Signal strength: %d", result);
dlclose(libHandle);

as i kno, signal strength is in dBm value (in negative), but why the value above show positif value and now shown the signal strength? is there any value mapping to present the signal strength on dBm

P.S i ran the program on the real iphone devices and still get wrong value.

any help would be appreciate.

Thanks.

Gerena answered 24/11, 2011 at 8:54 Comment(0)
C
3

About the carrier: Running your code on the simulator gives me nil while running on a device correctly says 2011-11-24 10:49:05.182 testapp[12579:707] Carrier Name: Vodafone.de, so the code is absolutely correct (running on iOS 5.0.1 using Xcode 4.2). Maybe your carrier didn't fill out some field correctly? In any case I would consider testing on another device or with another SIM card.

Concerning signal strength: As CTGetSignalStrength seems to be a rather undocumented API the values may be arbitrarily defined by Apple (and redefined as well). In any case this seems to be a RSSI value (received signal strength indication) which is more or less a positive number where 1 is the worst signal strength and upper is better. As such there is no predefined (documented and thus stable) available mapping to dBm values, a mapping would probably have to be created experimentally.

Carpophagous answered 24/11, 2011 at 9:54 Comment(1)
i dont think CTGetSignalStength in RSSI form, since i learn how to convert it to dBm, its not match with dBm iphone shown.Gerena
P
2

It is quite common that signal strength values are returned as integer numbers. The tricky point is the mapping to the corresponding dBm value. Usually the int values provide a resolution of 0.5, 1, or 2 dBm. The dBm values reported by the handset/modem usually range from -115 to -51 dBm for 2G (GSM/EDGE) and -120 to -25 dBm for 3G (UMTS/HSxPA) and represent the RSSI (received signal strength indicator).

E.g. the Android API uses the default 3GPP mapping (see Android reference).

Please take also into account that the baseband modem differs between the iPhone 4S (Qualcomm) and earlier models which used an Infineon Gold.

Petrology answered 1/3, 2012 at 20:31 Comment(2)
as of iOS 5.0 at least, iPhone is not using the same 3GPP mapping, unfortunately. I ran the code, and got values outside the range 0..31,99.Apus
Yes, both iPhone 4 (Infineon) and iPhone 4S (Qualcomm) use an internal mapping of signal strength. Furthermore, some values (e.g. 0 and 11) seem to be reported in case not network connection is available (modem switched off or coverage hole).Petrology

© 2022 - 2024 — McMap. All rights reserved.