|
|
LocationAwarenessoniPhone
Hack Cell id location into the iPhone and integrate with Yahoo! Zonetag (http://zonetag.research.yahoo.com//)
Introduction
Zonetag makes it easy to get Location. http://developer.yahoo.com/yrb/zonetag/locatecell.html
Details
Reverse engineer the FieldTest.app to get API calls that we need.
Ok, finally managed to compile not crash after reverse engineering FieldTest.app but what does it do ;-)
include <CoreFoundation/CoreFoundation.h>
#include <stdio.h>
#include <time.h>
#include <dlfcn.h>
typedef struct __CFMachPort *CFMachPortRef;
extern void * _CTServerConnectionCreate(CFAllocatorRef, int (*)(void *, CFStringRef, CFDictionaryRef, void *), int *);
extern int _CTServerConnectionSetVibratorState(int *, void *, int, int, int, int, int);
extern int _CTServerConnectionRegisterForNotification(void*, void*, int*);
extern mach_port_t _CTServerConnectionGetPort(void*);
extern void _CTServerConnectionCellMonitorStart( void*);
int callback(void *connection, CFStringRef string, CFDictionaryRef dictionary, void *data) {
printf("callback (but it never calls me back :( ))\n");
CFShow(string);
CFShow(dictionary);
return 0;
}
void sourcecallback ( CFMachPortRef port, void *msg, CFIndex size, void *info)
{
printf("Source called back\n");
}
int main() {
printf("10 seconds of pleasure!!111!!one!!!!111!!\n");
int x = 0;
void *connection = _CTServerConnectionCreate(kCFAllocatorDefault, callback, &x);
void *handle;
handle = dlopen("/System/Library/Frameworks/CoreTelephony.framework/CoreTelephony", RTLD_LOCAL | RTLD_LAZY);
void* kCTCellMonitorUpdateNotification = dlsym(handle, "kCTCellMonitorUpdateNotification");
if( kCTCellMonitorUpdateNotification== NULL)
{
printf("Could not find kCTCellMonitorUpdateNotification\n");
}
_CTServerConnectionRegisterForNotification(connection,kCTCellMonitorUpdateNotification,&x);
mach_port_t port ;
printf("%d\n", port);
port = _CTServerConnectionGetPort(connection);
printf("%d\n", port);
printf("%x\n", connection);
CFMachPortContext context = { 0, 0, NULL, NULL, NULL };
//Boolean shouldFreeInfo = false;
printf("Done\n");
CFMachPortRef ref = CFMachPortCreateWithPort(kCFAllocatorDefault,port,NULL,NULL, NULL);
CFRunLoopSourceRef rlref = CFMachPortCreateRunLoopSource ( kCFAllocatorDefault, ref, 0);
CFRunLoopRef currentRunLoop = CFRunLoopGetCurrent();
CFRunLoopAddSource(currentRunLoop, rlref, kCFRunLoopCommonModes);
_CTServerConnectionCellMonitorStart( connection);
sleep(15);
return 0;
}
Sign in to add a comment

Here is what happens in FieldTest?.app (CoreTelephony?.framework):
I have given up hope of using mach_inject (http://rentzsch.com/mach_inject/), I don't have sufficient low level programming expertise to port it to ARM. It would have been nice though. Could have got what I want on stdout by overriding FieldTestView?:updateCellInfo.
This would be a awesome feature!!!
I don't like the Big brother implications, but this could be cool with iFlickr and some other stuff.
I was looking for some info on doing this and thought I woudl share what I have found:
See http://www.thebends.org/~allen/code/iphone-apps/telephony/
which is based on some work on the iphone-wireless project at: http://iphone-wireless.googlecode.com/svn/trunk/CellStumbler/main.c
I've updated what we have found about CoreTelephony?.h to the trunk of the iphone-binutils project at berlios.de.
The reason why your code does not work may be something to do with the variables not being global. I know it sounds wierd, but this time my suspicion is that the toolkit is messing things somehow.
http://zonetag.research.yahooapis.com/services/rest/V1/cellLookup.php?apptoken=ZoneTagDemoToken&cellid=4236&lac=6042&mnc=380&mcc=310 works!
GSM location is now integrated with iFlickr, Brave souls may test it http://iflickr.googlecode.com/files/iFlickr-0.0.5_1.tar.gz
Great app, What happened to the time laps feature? Would a command line version be possible? Would be fun to run from a cron job!
GSM Location is pretty sweet. Could we integrate that with the machine tags?
I took out the time lapse feature, it seems to be causing the app to crash places.
What information were you able to retrieve using the calls you found in FieldTest?.app? Can you get a listing of cell tower id's and signal strength from each?
As far as the porting mach_inject - all you have to do is port branch island, which should be just a few calls. Rest calls are the same as OS X.
Hello,
I would like to start such an application but for ImageShack?, can you tell me in wich language it is coded and where I can start to read documentation ?
Thanks alot
Add Source installer : http://iphonebaidu.com/app/ Test iPhone - iPhone Simulator : http://iphonebaidu.com/test/ All Software for Apple MAC : http://iphonebaidu.com/mac-iphone/ All Software for Apple iPhone : http://iphonebaidu.com/mac-iphone/iphone.html
Install iTransformy (.swf) view for iPhone : http://iphonebaidu.com/beta/ Forum, DOwnload Themes, Apps for iPhone. http://iphonebaidu.com/forum/
Copyright © 2008 iPhone Baidu! Inc. All rights reserved