Using GraphicsServices.h/GSEvent as well as compiling CLI iPhone tools with XCode
- by Peter Hajas
I sent this to KennyTM (has all the private framework headers on GitHub) but I figured I'd ask here too just in case someone has some good ideas or any way to help me out.
I'm trying to write a command line utility that sends GSEvents to operate the keyboard, touch/drag elements onscreen, and operate hardware buttons (volume, home, sleep, etc.)
I grabbed the MouseSupport code and tried to look through it, but I couldn't find the easiest way to send GSEvents. I'm hoping someone here can help me.
First, what's the simplest way to declare a GSEvent and send it? I looked at the iPhone development wiki, but the documentation was very vague. I understand that there's a purple event port (?) that I have to send these events to, but I don't understand how to do that. Could someone offer examples for, say, touching at a coordinate, typing a certain key, or pressing a hardware button?
Also, do I have to write or do anything special if I want this utility to operate all applications as well as Springboard? I don't know if this is a special case because I want it at the OS level. Ideally, I would SSH into the phone, start the program, and it would send GSEvents that would be handled by whatever application was open.
As far as compiling this code, is there any way to do so under XCode? I don't know what sort of project template I should use (if any) and this is throwing me off. I don't need "build and go" support, I'm more than happy to scp the program over to the phone. I understand that compiling the code is also feasible on the phone. I have all of the headers from the SDK on my phone along with iphone-gcc, but when compiling some test programs I still get errors about not finding mach headers and CoreFoundation. Is there an easier way to do this?
Lastly, are there other guides or pieces of literature that anyone can point me towards for learning more about this? I'm excited to get into open iPhone development (I have experience with the official SDK, but I want to go deeper).
Thanks for any and all help people can offer!