X-Plane has support for custom commands. Study what kind of protocol is needed to support them and implement it in the code. Should be pretty straightforward.
Example code with custom command:
http://www.xsquawkbox.net/xpsdk/mediawiki/Custom_Command_with_Custom_DataRef