/******************************************************************************* * iPhone-Wireless Project : Telephony Library * * Copyright (C) 2007 Geohot * * Copyright (C) 2007-2008 Pumpkin * * Copyright (C) 2007-2008 Lokkju * ******************************************************************************* * $LastChangedDate:: $ * * $LastChangedBy:: $ * * $LastChangedRevision:: $ * * $Id:: $ * ******************************************************************************* * This program is free software: you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program. If not, see . * *******************************************************************************/ /* $HeadURL$ */ #include "CoreTelephony.h" #include #include #include /* main.c : Hack to CoreTelephony. Most of the peculiarities of the code below is based on obervation. */ /* For some reason, all these variables have to be global. Toolchain bug? */ CFMachPortRef port; struct CTServerConnection *sc=NULL; struct CellInfo cellinfo; int b; int t1; /* Never called. */ void callback() { printf("Callback called\n"); } /* Again, _CTServerConnectionCreate() has to be called outside the main(), or whatever is using CTServerConnection. Hence the existence of this function. */ void cellconnect() { int t1; sc=_CTServerConnectionCreate(kCFAllocatorDefault, callback, NULL); /* port is not currently used, shuld be usable with a runloop. */ port=CFMachPortCreateWithPort(kCFAllocatorDefault, _CTServerConnectionGetPort(sc), NULL, NULL, NULL); _CTServerConnectionCellMonitorStart(&t1,sc); printf("Connected\n"); } void getCellInfo() { int cellcount; _CTServerConnectionCellMonitorGetCellCount(&t1,sc,&cellcount); printf("Cell count: %x\n",cellcount); printf("Size = %x\n", sizeof(struct CellInfo)); unsigned char *a=malloc(sizeof(struct CellInfo)); for(b=0;b