iPhone 3.5mm Audio jack specification (buttons)
Apple will give you the information to work with/duplicate the "Headset Remote and Mic" (aka the little box on each pair of EarPods that have the three buttons and microphone) if you join their MFi program, as noted in the MFi FAQ and on BoingBong when the three-button setup first came out. I haven't seen anyone online reverse-engineer it and publish information about how it works.