Commit Graph

47 Commits

Author SHA1 Message Date
Jason Watkins
c6f9669e36 Added support for setting speed brakes to C client. 2015-05-05 13:04:08 -07:00
Jason Watkins
aeceb87f1d Merge latest changes from release-1.0.1
Removing all C++11 features touches many parts of many files, so better merge the changes into develop ASAP to prevent future conflicts.
2015-05-05 08:33:54 -07:00
Jason Watkins
8ed6b39779 Increased the timeout for select in the C client on Windows. 2015-05-04 14:58:55 -07:00
Chris Teubert
c44f521842 pauseSim should be returning int on error 2015-05-04 10:30:10 -07:00
Jason Watkins
0b984c3d49 Updated C client to support "switch" argument in SIMU command. 2015-05-01 14:55:36 -07:00
Jason Watkins
902aa006e8 Updated C client socket timeout.
The C client previously set a very short read timeout because it was required
 by the plugin. To compensate for this on the client side, we would try to
read several times in a loop. Since the plugin no longer uses the C client for
networking, we can do away with the loops and set a proper timeout.
2015-04-30 09:04:32 -07:00
Chris Teubert
761ee793ba Updates to use new function names 2015-04-29 13:57:50 -07:00
Jason Watkins
54368bb65a C client API tweaks
- Swaped names of openUDP and aopenUDP.
 - openUDP is now the "automatic" version, requiring only the X-Plane IP address.
 - aopenUDP is now the "advanced" version, requiring both the X-Plane port and a client port.
 - Added support for passing NULL to sendTEXT.
2015-04-29 12:44:19 -07:00
Jason Watkins
3b2e697158 Removed 'p' variants of the sendCTRL and sendPOSI functions from the C client. 2015-04-29 08:14:55 -07:00
Jason Watkins
8932edbd67 Renamed "setDREF" function back to "sendDREF". 2015-04-28 12:10:53 -07:00
Chris Teubert
3c43517e44 Fix Bug in getDREF Response
Fix Bug- readUDP loop in getDREF Response only ran once no matter what.
This wasn’t enough time for the plugin to send a response.

Note: You can try increasing the timeout, but the plugin has to have a
socket with a timeout of 1ms or less. If the timeout is higher than
that a lag is introduced.
2015-04-28 12:10:33 -07:00
Chris Teubert
c2ab55e2d0 Fix sendTEXT bug
sendText using the number 40 instead of message length in sendUDP call.
Messages would be cut off if longer than this
2015-04-24 11:00:53 -07:00
Jason Watkins
fe5689aaa2 Removed internal C client functions from the C client header. 2015-04-23 16:20:42 -07:00
Jason Watkins
7da82f40dc Several variable name tweaks and error checking changes.
- Minimal functional changes. The primary purpose of these tweaks is to make the clients more consistent across languages.
2015-04-23 11:12:42 -07:00
Jason Watkins
02f4c92fce Tweaked param name on setDREF in C client. 2015-04-23 11:12:41 -07:00
Chris Teubert
368c3bed20 fix- aopenUDP not returning socket 2015-04-23 10:08:05 -07:00
Chris Teubert
795e284ab2 A few mac fixes 2015-04-23 10:07:47 -07:00
Jason Watkins
55f3953955 Fixed errors and removed unused code in the C client.
- Fixed a buffer overflow in sendCTRL.
 - Fixed incorrect inderection in readUDP.
 - Removed unused usleep function.
 - Removed redundant include of WS2tcpip.h
 - Fixed widespread error where sendUDP's return value was not being checked correctly.
 - Updated signature of openUDP to place optional parameters at the end
 - Fixed bug in CTRL command where the buffer length was not correctly set.
 - Fixed setCONN to correctlly reset the client's socket.
2015-04-17 10:56:03 -07:00
Jason Watkins
b7ace82649 Cleaned up drawing functions. 2015-04-17 10:56:02 -07:00
Jason Watkins
6ac20f0998 Cleaned up CTRL functions.
- Removed parseCTRL and readCTRL.
 - Tweaked variable type, order and naming.
 - Improved validation and error reporting.
 - Updated Interface Control Document to reflect adition of aircraft number to CTRL command.
2015-04-17 10:56:01 -07:00
Jason Watkins
0e6195c063 Cleaned up POSI functions.
- Removed readPOSI and parsePOSI functions. These were only used by the plugin, which no longer uses them.
 - Tweaked types, argument order, and names to improve concision and consistency with other functions.
 - Improved validation and error reporting.
2015-04-17 10:56:01 -07:00
Jason Watkins
80a1a2dcd2 Cleaned up DREF functions and tweaked printError.
- printError is now a varags function, and will print format strings for the message.
 - Removed several internal DREF functions from the header file.
 - Significantly improved error reporting in DREF functions.
 - Removed dynamic allocation for responses. Clients are now expected to provide fully allocated storage for getDREFs. An error message will be printed if the provided structure is too small.
 - Fixes nasa/XPlaneConnect#30
2015-04-17 10:56:00 -07:00
Jason Watkins
4e7e816da1 Cleaned up DATA related functions.
- Tweaked signatures to improve consistency and safety.
 - Improved error logging.
 - Removed parseDATA. When merged into readDATA, the meat of parseDATA is only a few lines of code.
2015-04-17 10:56:00 -07:00
Jason Watkins
9f670954cc Cleaned up setCONN and pauseSim functions.
- Tweaked function signatures to more accurately reflect internal behavior.
 - Changed behavior of setCONN to use the inbound port of the socket passed to it.
 - Greatly enhanced error reporting for setCONN and pauseSim.
2015-04-17 10:55:59 -07:00
Jason Watkins
1a8078af87 Various changes to improve consistency and readability of low level UDP functions.
- Tweaked variable names to be more concise.
 - Moved variable declarations from top of function to point of use.
 - Replaced memcpy with strncpy where appropriate.
 - Removed socket reuse options on *nix builds.
 - Improved error reporting.
 - Most failures when opening and closing sockets now cause the client to die.
 - sendUDP now ignores the length byte.
2015-04-17 10:55:59 -07:00
Jason Watkins
a6196dece9 C client style tweaks.
- Standardized C client to use tabs.
 - Improved consistency of indentation.
 - Updated copyright and description headers.
2015-04-17 10:54:55 -07:00
Jason Watkins
6417822a75 Added C test for WYPT command and fixed bugs in parseWYPT and sendWYPT. 2015-04-09 12:17:52 -07:00
Jason Watkins
1a83517bee Implemented plugin support for handling WYPT commands. 2015-04-09 12:17:41 -07:00
Chris Teubert
efc591ead4 Added missing return 2015-04-08 09:12:56 -07:00
Jason Watkins
46913596c5 Added support for the TEXT command to the C client. 2015-04-07 15:33:46 -07:00
Jason Watkins
abf2a426d2 Added C client support for multiplayer sendCTRL commands. 2015-04-07 10:43:39 -07:00
Jason Watkins
a05ddb42be 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.
2015-04-07 10:38:57 -07:00
Chris Teubert
5d50d970bd sendCTRL Bug
Fixed bug where sendCTRL is sending gear as float. Changed to char as
specified in ICD.
2015-04-01 15:58:01 -07:00
Jason Watkins
66b074d89b Tweaks to fix setCONNTest on Windows 8
- Temporarily disabled the sending of a CONF message from the plugin in response to setCONN. The CONF message causes crashes on Windows 8 when setCONN is called multiple times.
 -  Removed code that attempted to free result slots in parseRequest before overwritting them with new allocations. The CTests suite currently calls parseRequest with a multidimensional array allocated on the stack, resulting in an attempt to free stack memory. A better solution may be to simply check whether the existing result slots are long enough.
 - As of this commit, all tests in the CTests suite are passing on Windows 8 for X-Plane 9, X-Plane 10 23bit and X-Plane 10 64bit.
2015-03-24 16:11:37 -07:00
Jason Watkins
fbeb297717 Fixed CTests bugs, minor plugin enhancements, and removed old files
- Fixed incorrect message buffer size in sendCTRL function.
 - Fixed a bug in sendCTRLTest where not all DREF sizes were being set.
 - Increased message buffer size in sendReadTest to account for assumptions made by sendUDP.
 - Fixed a bug in updateLog where the log message would sometimes start with several null characters, causing the log message to be effectively ignored by fprintf.

 - The xpcPlugin Visual Studio solution now supports 32 bit and 64 bit builds.
 - Logging performed by the plugin now works correctly on Windows.
 - Long log messages are now truncated to 500 characters. Previously, messages over 500 characters would be omitted, and an error message logged in their place.

 - Several files which were incorrectly added to source control have been deleted.
2015-03-24 14:29:39 -07:00
jwatkins42
97b9c9a682 Fixed memory leak and incorrect copy bugs.
- The result of a call to realloc was erroneously thrown away, creating a potential memory leak.
 - Values were being copied to an array on the stack, then memcpy'ed into an array on the heap. Since the heap array is freshly allocated, it should be completely safe to memcpy the data directly into it.
 - The inner loop was copying the same value several times, rather than copying several values in series.
2014-12-08 22:17:55 -08:00
Chris Teubert
a396088ed8 Removed unnecessary use of pointer in parseDATA 2014-12-04 10:35:24 -08:00
Chris Teubert
dcce37573f Quick fix- msTimeOut to usTimeOut 2014-12-03 10:26:01 -08:00
jwatkins42
d70148b98d Reverted timeout changes and added clarifying comment. 2014-12-02 21:32:45 -08:00
jwatkins42
f582d7fec0 Removed duplicate socket initialization and corrected timeout values. 2014-12-02 21:01:52 -08:00
Chris Teubert
2f6bc72825 Fixed Buffer overrun in sendCTRL 2014-12-02 10:07:41 -08:00
Chris Teubert
851cebeea0 Testing improvements- C/C++ 2014-12-01 15:36:37 -08:00
Chris Teubert
9ea7011bfb Fixed bug in xplaneConnect.c
Fixed bug in openUDP where sockets could not be reopened in OS X
2014-12-01 14:44:06 -08:00
Chris Teubert
e36dcbb693 Minor fix for requestDREF
Fix for requestDREF
2014-11-28 10:05:56 -08:00
Chris Teubert
678b04491d Documentation/Version Number Changes 2014-11-24 12:29:40 -08:00
Chris Teubert
e4fed91077 Documentation Changes 2014-11-24 12:15:57 -08:00
Chris Teubert
8013ce1003 Initial Version 2014-10-22 15:52:38 -07:00