CoreTelephony

From The iPhone Wiki
Revision as of 21:05, 8 July 2009 by Cyanidepoison (talk | contribs) (New page: CoreTelephony is the iPhone framework used for high-level cell modem interaction. It handles SMS, MMS, phone calls, etc. It is written in C, C++, and in 3.0, Objective-C portions were ad...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

CoreTelephony is the iPhone framework used for high-level cell modem interaction. It handles SMS, MMS, phone calls, etc. It is written in C, C++, and in 3.0, Objective-C portions were added.

Usage

In order to use CoreTelephony, you need to set up your build environment to link against it.
You also need a set of header files, which can be obtained by using the class-dump tool on the framework.

C functions/types

 typedef struct __CTSMSMessage CTSMSMessage;
 void*                CTTelephonyCenterGetDefault();
 void                 CTSMSMessageSend(void*,CTSMSMessage*);
 CFStringRef          CTSMSMessageCopyAddress(void *, CTSMSMessage *);
 CFStringRef          CTSMSMessageCopyText(void *, CTSMSMessage *);
 CTSMSMessage*        CTSMSMessageCreate(void*,CFStringRef number, CFStringRef name);


Objective-C

The ObjC parts are much easier to work with because of the magic of class-dump. The only work I've done is getting an SMS message sent out. This can be accomplished in one line of code:

 [[CTMessageCenter sharedMessageCenter]  sendSMSWithText:message serviceCenter:nil toAddress:number];

where message and number are NSStrings filled with the correct data.