Modified parseCTRL and readCTRL to return a struct.

- Defined a new struct that contains the information sent by the CTRL command
 - Added some additional validation to parseCTRL.
 - Changed the return type of parseCTRL and removed now redundant pointer parameters.
 - Propagated return type change throughout the plugin code base.
This commit is contained in:
Jason Watkins
2015-04-06 12:40:26 -07:00
parent 04166d3bac
commit a05ddb42be
4 changed files with 72 additions and 45 deletions

View File

@@ -36,6 +36,17 @@
int sock;
#endif
};
typedef struct
{
float pitch;
float roll;
float yaw;
float throttle;
char gear;
float flaps;
char aircraft;
} xpcCtrl;
// Basic Functions
struct xpcSocket openUDP(unsigned short port, const char *xpIP, unsigned short xpPort);
@@ -58,8 +69,8 @@
short sendPOSI(struct xpcSocket recfd, short ACNum, short numArgs, float valueArray[]);
// Controls
float parseCTRL(const char my_message[], float resultArray[4], short *gear);
float readCTRL(struct xpcSocket recfd, float resultArray[4], short *gear);
xpcCtrl parseCTRL(const char data[]);
xpcCtrl readCTRL(struct xpcSocket recfd);
short sendCTRL(struct xpcSocket recfd, short numArgs, float valueArray[]);
// DREF Manipulation