From: Damiano B. <da...@da...> - 2012-06-19 15:18:47
|
Hi My name is Damiano Bortolato and I'm new on this list and I would like to contribute to this wonderful project. I think it would be useful for Glider pilots (like me) to train themselves on a simulator with XCSoar connected to it. I've already seen that it's possible to attach it to Condor simulator, nevertheless I'm a Silent Wings user, so I would contribute to support also this simulator. Silent Wings can provide output data connecting through and UDP (only UDP http://wiki.silentwings.no/index.php?title=UDP_Output) network connection, users can choose between a "Condor format" (clear text) and a SW native binary format. At the beginning I thought the problem was only TCP vs UDP so I wrote a small Python gateway to redirect the connection between UDP and TCP, but it didn't worked. As I discovered later the SW's "condor format" is not compatible with the "Condor driver" on XCSoar (wich makes just a sort of NMEA code translation), so data mangling is needed between SW and XCSoar. I've made the following changes: 1) Changed the "TCP Listener" port type to a generic "Network" port. 2) Added a DataFiledEnum control to choose the protocol (TCP or UDP) 3) Added UDPPort class. Up to here I've only generalized the network server configuration, and XCSoar is now able to listen also to UDP clients. To do this I changed the configuration key 'TCPPort' to 'NetworkPort' and the 'tcp_listener' port type to 'network' port type. I've also added the configuration Key 'NetworkProtocol', so now the configuration file look like this: DeviceA="Silent Wings" PortBaudRate="4800" PortBluetoothMAC="" PortBulkBaudRate="0" PortDumpPort="0" PortIOIOUartID="0" PortIgnoreChecksum="0" PortK6Bt="0" PortNetworkPort="4353" PortNetworkProtocol="UDP" PortPath="" PortSyncFromDevice="1" PortSyncToDevice="1" PortType="network" UserLevel="0" After that I've added: 4) New "Silent Wings" driver. This driver receives raw data from SW and populates NMEA info for XCSoar. It seems to work fine on UNIX platform, I'll test it also on other platforms (I can easily do it on Windows and Android) before to send the patches or submit the commits. I've carefully read the developer policy, so I wrote the code according to it. I don't know if such a modification can be considered just a "patch", at the moment git status reports: # On branch master # Changes to be committed: # (use "git reset HEAD <file>..." to unstage) # # new file: src/Device/Driver/SilentWings.cpp # new file: src/Device/Driver/SilentWings.hpp # new file: src/Device/Port/UDPPort.cpp # new file: src/Device/Port/UDPPort.hpp # # Changes not staged for commit: # (use "git add <file>..." to update what will be committed) # (use "git checkout -- <file>..." to discard changes in working directory) # # modified: build/driver.mk # modified: build/libport.mk # modified: src/Device/Port/ConfiguredPort.cpp # modified: src/Device/Register.cpp # modified: src/Device/device.cpp # modified: src/OS/SocketDescriptor.cpp # modified: src/OS/SocketDescriptor.hpp # modified: src/Profile/DeviceConfig.cpp # modified: src/Profile/DeviceConfig.hpp # modified: src/Widgets/DeviceEditWidget.cpp and git diff --stat reports: build/driver.mk | 1 + build/libport.mk | 3 + src/Device/Port/ConfiguredPort.cpp | 26 ++++++++--- src/Device/Register.cpp | 2 + src/Device/device.cpp | 2 +- src/OS/SocketDescriptor.cpp | 43 ++++++++++++++++++ src/OS/SocketDescriptor.hpp | 3 + src/Profile/DeviceConfig.cpp | 86 +++++++++++++++++++++++++++++++----- src/Profile/DeviceConfig.hpp | 37 ++++++++++++---- src/Widgets/DeviceEditWidget.cpp | 76 ++++++++++++++++++++++++-------- 10 files changed, 233 insertions(+), 46 deletions(-) Please if you have suggestions or comments let me know, I hope to be useful. Damiano |