First GIT Commit

This commit is contained in:
John Wiseman 2022-08-30 11:28:28 +01:00
commit 9837031906
41 changed files with 20859 additions and 0 deletions

1546
AGWCode.cpp Normal file

File diff suppressed because it is too large Load Diff

148
AGWConnect.ui Normal file
View File

@ -0,0 +1,148 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>AGWConnectDkg</class>
<widget class="QDialog" name="AGWConnectDkg">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>500</width>
<height>400</height>
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
</property>
<widget class="QWidget" name="verticalLayoutWidget">
<property name="geometry">
<rect>
<x>10</x>
<y>10</y>
<width>480</width>
<height>380</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QFormLayout" name="formLayout_2">
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Call From </string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="CallFrom"/>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Call To </string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="CallTo">
<property name="editable">
<bool>true</bool>
</property>
<property name="insertPolicy">
<enum>QComboBox::NoInsert</enum>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Digis</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLineEdit" name="Digis"/>
</item>
</layout>
</item>
<item>
<widget class="QLabel" name="label_4">
<property name="text">
<string>Radio Ports</string>
</property>
</widget>
</item>
<item>
<widget class="QListWidget" name="RadioPorts"/>
</item>
<item>
<layout class="QHBoxLayout">
<property name="spacing">
<number>6</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QPushButton" name="okButton">
<property name="text">
<string>OK</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="cancelButton">
<property name="text">
<string>Cancel</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</widget>
<resources/>
<connections>
<connection>
<sender>okButton</sender>
<signal>clicked()</signal>
<receiver>AGWConnectDkg</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>278</x>
<y>253</y>
</hint>
<hint type="destinationlabel">
<x>96</x>
<y>254</y>
</hint>
</hints>
</connection>
<connection>
<sender>cancelButton</sender>
<signal>clicked()</signal>
<receiver>AGWConnectDkg</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>369</x>
<y>253</y>
</hint>
<hint type="destinationlabel">
<x>179</x>
<y>282</y>
</hint>
</hints>
</connection>
</connections>
</ui>

395
AGWParams.ui Normal file
View File

@ -0,0 +1,395 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>AGWParams</class>
<widget class="QDialog" name="AGWParams">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>562</width>
<height>491</height>
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
</property>
<widget class="QLineEdit" name="TermCall">
<property name="geometry">
<rect>
<x>120</x>
<y>50</y>
<width>113</width>
<height>20</height>
</rect>
</property>
</widget>
<widget class="QGroupBox" name="groupBox">
<property name="geometry">
<rect>
<x>12</x>
<y>83</y>
<width>537</width>
<height>215</height>
</rect>
</property>
<property name="title">
<string>Beacon Setup</string>
</property>
<widget class="QLineEdit" name="beaconDest">
<property name="geometry">
<rect>
<x>110</x>
<y>24</y>
<width>113</width>
<height>20</height>
</rect>
</property>
</widget>
<widget class="QLineEdit" name="beaconPath">
<property name="geometry">
<rect>
<x>110</x>
<y>54</y>
<width>113</width>
<height>20</height>
</rect>
</property>
</widget>
<widget class="QLineEdit" name="beaconInterval">
<property name="geometry">
<rect>
<x>108</x>
<y>84</y>
<width>45</width>
<height>20</height>
</rect>
</property>
</widget>
<widget class="QLineEdit" name="beaconPorts">
<property name="geometry">
<rect>
<x>110</x>
<y>114</y>
<width>43</width>
<height>20</height>
</rect>
</property>
</widget>
<widget class="QLabel" name="label_2">
<property name="geometry">
<rect>
<x>14</x>
<y>22</y>
<width>75</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string>Destination</string>
</property>
</widget>
<widget class="QLabel" name="label_3">
<property name="geometry">
<rect>
<x>14</x>
<y>52</y>
<width>75</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string>Digipeaters</string>
</property>
</widget>
<widget class="QLabel" name="label_4">
<property name="geometry">
<rect>
<x>14</x>
<y>82</y>
<width>75</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string>Interval</string>
</property>
</widget>
<widget class="QLabel" name="label_5">
<property name="geometry">
<rect>
<x>14</x>
<y>112</y>
<width>75</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string>Ports</string>
</property>
</widget>
<widget class="QLabel" name="label_6">
<property name="geometry">
<rect>
<x>176</x>
<y>82</y>
<width>75</width>
<height>22</height>
</rect>
</property>
<property name="text">
<string>Minutes</string>
</property>
</widget>
<widget class="QLabel" name="label_7">
<property name="geometry">
<rect>
<x>176</x>
<y>112</y>
<width>137</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string>(Separate with commas)</string>
</property>
</widget>
<widget class="QLabel" name="label_11">
<property name="geometry">
<rect>
<x>14</x>
<y>144</y>
<width>75</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string>Message</string>
</property>
</widget>
<widget class="QPlainTextEdit" name="beaconText">
<property name="geometry">
<rect>
<x>110</x>
<y>140</y>
<width>425</width>
<height>63</height>
</rect>
</property>
</widget>
<widget class="QLabel" name="label_12">
<property name="geometry">
<rect>
<x>14</x>
<y>158</y>
<width>95</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string>(max 256 chars)</string>
</property>
</widget>
</widget>
<widget class="QGroupBox" name="groupBox_2">
<property name="geometry">
<rect>
<x>12</x>
<y>300</y>
<width>537</width>
<height>123</height>
</rect>
</property>
<property name="title">
<string>TNC Setup</string>
</property>
<widget class="QLineEdit" name="Host">
<property name="geometry">
<rect>
<x>110</x>
<y>24</y>
<width>101</width>
<height>20</height>
</rect>
</property>
</widget>
<widget class="QLineEdit" name="Port">
<property name="geometry">
<rect>
<x>110</x>
<y>54</y>
<width>47</width>
<height>20</height>
</rect>
</property>
</widget>
<widget class="QLineEdit" name="Paclen">
<property name="geometry">
<rect>
<x>110</x>
<y>84</y>
<width>47</width>
<height>20</height>
</rect>
</property>
</widget>
<widget class="QLabel" name="label_8">
<property name="geometry">
<rect>
<x>16</x>
<y>24</y>
<width>47</width>
<height>13</height>
</rect>
</property>
<property name="text">
<string>Host</string>
</property>
</widget>
<widget class="QLabel" name="label_9">
<property name="geometry">
<rect>
<x>16</x>
<y>54</y>
<width>47</width>
<height>13</height>
</rect>
</property>
<property name="text">
<string>Port</string>
</property>
</widget>
<widget class="QLabel" name="label_10">
<property name="geometry">
<rect>
<x>16</x>
<y>84</y>
<width>47</width>
<height>13</height>
</rect>
</property>
<property name="text">
<string>Paclen</string>
</property>
</widget>
</widget>
<widget class="QLabel" name="label">
<property name="geometry">
<rect>
<x>18</x>
<y>48</y>
<width>111</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string>Terminal Callsign</string>
</property>
</widget>
<widget class="QPushButton" name="okButton">
<property name="geometry">
<rect>
<x>180</x>
<y>440</y>
<width>95</width>
<height>23</height>
</rect>
</property>
<property name="text">
<string>OK</string>
</property>
</widget>
<widget class="QPushButton" name="cancelButton">
<property name="geometry">
<rect>
<x>292</x>
<y>440</y>
<width>79</width>
<height>23</height>
</rect>
</property>
<property name="text">
<string>Cancel</string>
</property>
</widget>
<widget class="QCheckBox" name="AGWEnable">
<property name="geometry">
<rect>
<x>152</x>
<y>16</y>
<width>23</width>
<height>25</height>
</rect>
</property>
<property name="layoutDirection">
<enum>Qt::RightToLeft</enum>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QLabel" name="label_13">
<property name="geometry">
<rect>
<x>20</x>
<y>18</y>
<width>135</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string>Enable AGW Interface</string>
</property>
</widget>
<widget class="QCheckBox" name="AGWMonEnable">
<property name="geometry">
<rect>
<x>255</x>
<y>18</y>
<width>216</width>
<height>21</height>
</rect>
</property>
<property name="layoutDirection">
<enum>Qt::RightToLeft</enum>
</property>
<property name="text">
<string>Enable AGW Monitor Window</string>
</property>
</widget>
</widget>
<resources/>
<connections>
<connection>
<sender>cancelButton</sender>
<signal>clicked()</signal>
<receiver>AGWParams</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>369</x>
<y>253</y>
</hint>
<hint type="destinationlabel">
<x>179</x>
<y>282</y>
</hint>
</hints>
</connection>
<connection>
<sender>okButton</sender>
<signal>clicked()</signal>
<receiver>AGWParams</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>278</x>
<y>253</y>
</hint>
<hint type="destinationlabel">
<x>96</x>
<y>254</y>
</hint>
</hints>
</connection>
</connections>
</ui>

440
ColourConfig.ui Normal file
View File

@ -0,0 +1,440 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>ColourDialog</class>
<widget class="QDialog" name="ColourDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>342</width>
<height>407</height>
</rect>
</property>
<property name="windowTitle">
<string>Colour Selection</string>
</property>
<widget class="QWidget" name="layoutWidget">
<property name="geometry">
<rect>
<x>66</x>
<y>350</y>
<width>199</width>
<height>33</height>
</rect>
</property>
<layout class="QHBoxLayout">
<property name="spacing">
<number>6</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QPushButton" name="okButton">
<property name="text">
<string>OK</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="cancelButton">
<property name="text">
<string>Cancel</string>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QPushButton" name="TermBG">
<property name="geometry">
<rect>
<x>216</x>
<y>15</y>
<width>75</width>
<height>23</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>75</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>75</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QPushButton" name="InputBG">
<property name="geometry">
<rect>
<x>216</x>
<y>247</y>
<width>75</width>
<height>23</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>75</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>75</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QPushButton" name="InputColour">
<property name="geometry">
<rect>
<x>216</x>
<y>276</y>
<width>75</width>
<height>23</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>75</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>75</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>Input</string>
</property>
</widget>
<widget class="QPushButton" name="TermNormal">
<property name="geometry">
<rect>
<x>216</x>
<y>44</y>
<width>75</width>
<height>23</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>75</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>75</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>Normal</string>
</property>
</widget>
<widget class="QPushButton" name="Echoed">
<property name="geometry">
<rect>
<x>216</x>
<y>73</y>
<width>75</width>
<height>23</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>75</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>75</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>Echoed</string>
</property>
</widget>
<widget class="QPushButton" name="Warning">
<property name="geometry">
<rect>
<x>216</x>
<y>102</y>
<width>75</width>
<height>23</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>75</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>75</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>Warning</string>
</property>
</widget>
<widget class="QLabel" name="label">
<property name="geometry">
<rect>
<x>21</x>
<y>16</y>
<width>187</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>Terminal Background </string>
</property>
</widget>
<widget class="QLabel" name="label_2">
<property name="geometry">
<rect>
<x>21</x>
<y>45</y>
<width>185</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>Normal Text</string>
</property>
</widget>
<widget class="QLabel" name="label_3">
<property name="geometry">
<rect>
<x>21</x>
<y>74</y>
<width>191</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>Echoed Text</string>
</property>
</widget>
<widget class="QLabel" name="label_4">
<property name="geometry">
<rect>
<x>21</x>
<y>103</y>
<width>185</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>Warning Text</string>
</property>
</widget>
<widget class="QLabel" name="label_9">
<property name="geometry">
<rect>
<x>21</x>
<y>248</y>
<width>189</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>Input Background </string>
</property>
</widget>
<widget class="QLabel" name="label_10">
<property name="geometry">
<rect>
<x>21</x>
<y>277</y>
<width>183</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>Input Text</string>
</property>
</widget>
<widget class="QPushButton" name="MonRX">
<property name="geometry">
<rect>
<x>216</x>
<y>189</y>
<width>75</width>
<height>23</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>75</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>75</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>RX Text</string>
</property>
</widget>
<widget class="QPushButton" name="MonitorBG">
<property name="geometry">
<rect>
<x>216</x>
<y>131</y>
<width>75</width>
<height>23</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>75</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>75</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QPushButton" name="MonOther">
<property name="geometry">
<rect>
<x>216</x>
<y>218</y>
<width>75</width>
<height>23</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>75</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>75</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>Other Text</string>
</property>
</widget>
<widget class="QPushButton" name="MonTX">
<property name="geometry">
<rect>
<x>216</x>
<y>160</y>
<width>75</width>
<height>23</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>75</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>75</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>TX Text</string>
</property>
</widget>
<widget class="QLabel" name="label_5">
<property name="geometry">
<rect>
<x>21</x>
<y>132</y>
<width>187</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>Monitor Background </string>
</property>
</widget>
<widget class="QLabel" name="label_6">
<property name="geometry">
<rect>
<x>21</x>
<y>161</y>
<width>183</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>TX Text</string>
</property>
</widget>
<widget class="QLabel" name="label_7">
<property name="geometry">
<rect>
<x>21</x>
<y>190</y>
<width>187</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>RX Text</string>
</property>
</widget>
<widget class="QLabel" name="label_8">
<property name="geometry">
<rect>
<x>21</x>
<y>219</y>
<width>189</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>Other Text</string>
</property>
</widget>
</widget>
<resources/>
<connections/>
</ui>

381
KISSConfig.ui Normal file
View File

@ -0,0 +1,381 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>KISSDialog</class>
<widget class="QDialog" name="KISSDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>432</width>
<height>286</height>
</rect>
</property>
<property name="windowTitle">
<string>KISS Configuration</string>
</property>
<widget class="QWidget" name="layoutWidget">
<property name="geometry">
<rect>
<x>40</x>
<y>238</y>
<width>351</width>
<height>33</height>
</rect>
</property>
<layout class="QHBoxLayout">
<property name="spacing">
<number>6</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QPushButton" name="okButton">
<property name="text">
<string>OK</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="cancelButton">
<property name="text">
<string>Cancel</string>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QGroupBox" name="TNCInfo_3">
<property name="geometry">
<rect>
<x>10</x>
<y>96</y>
<width>401</width>
<height>57</height>
</rect>
</property>
<property name="title">
<string>TCP Setup</string>
</property>
<widget class="QLineEdit" name="Host">
<property name="geometry">
<rect>
<x>90</x>
<y>20</y>
<width>111</width>
<height>22</height>
</rect>
</property>
</widget>
<widget class="QLineEdit" name="Port">
<property name="geometry">
<rect>
<x>330</x>
<y>21</y>
<width>47</width>
<height>22</height>
</rect>
</property>
</widget>
<widget class="QLabel" name="label_20">
<property name="geometry">
<rect>
<x>16</x>
<y>24</y>
<width>47</width>
<height>13</height>
</rect>
</property>
<property name="text">
<string>Host</string>
</property>
</widget>
<widget class="QLabel" name="label_21">
<property name="geometry">
<rect>
<x>280</x>
<y>24</y>
<width>47</width>
<height>13</height>
</rect>
</property>
<property name="text">
<string>Port</string>
</property>
</widget>
<widget class="QLineEdit" name="Port_2">
<property name="geometry">
<rect>
<x>85</x>
<y>63</y>
<width>47</width>
<height>22</height>
</rect>
</property>
</widget>
<widget class="QLabel" name="label_24">
<property name="geometry">
<rect>
<x>20</x>
<y>66</y>
<width>47</width>
<height>13</height>
</rect>
</property>
<property name="text">
<string>Port</string>
</property>
</widget>
</widget>
<widget class="QGroupBox" name="groupBox_5">
<property name="geometry">
<rect>
<x>0</x>
<y>46</y>
<width>411</width>
<height>51</height>
</rect>
</property>
<property name="title">
<string>Serial TNC</string>
</property>
<widget class="QComboBox" name="SerialPort">
<property name="geometry">
<rect>
<x>150</x>
<y>20</y>
<width>111</width>
<height>22</height>
</rect>
</property>
</widget>
<widget class="QLabel" name="label_9">
<property name="geometry">
<rect>
<x>20</x>
<y>23</y>
<width>131</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>Select Device</string>
</property>
</widget>
<widget class="QLabel" name="label_23">
<property name="geometry">
<rect>
<x>280</x>
<y>20</y>
<width>47</width>
<height>22</height>
</rect>
</property>
<property name="text">
<string>Speed</string>
</property>
</widget>
<widget class="QLineEdit" name="Speed">
<property name="geometry">
<rect>
<x>335</x>
<y>21</y>
<width>51</width>
<height>22</height>
</rect>
</property>
<property name="text">
<string>19200</string>
</property>
</widget>
</widget>
<widget class="QLabel" name="label_14">
<property name="geometry">
<rect>
<x>10</x>
<y>12</y>
<width>161</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string>Enable KISS Interface</string>
</property>
</widget>
<widget class="QCheckBox" name="KISSEnable">
<property name="geometry">
<rect>
<x>150</x>
<y>10</y>
<width>23</width>
<height>25</height>
</rect>
</property>
<property name="layoutDirection">
<enum>Qt::RightToLeft</enum>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QLabel" name="label_22">
<property name="geometry">
<rect>
<x>230</x>
<y>13</y>
<width>61</width>
<height>17</height>
</rect>
</property>
<property name="text">
<string>MYCALL</string>
</property>
</widget>
<widget class="QLineEdit" name="MYCALL">
<property name="geometry">
<rect>
<x>300</x>
<y>10</y>
<width>91</width>
<height>22</height>
</rect>
</property>
</widget>
<widget class="QLabel" name="label_25">
<property name="geometry">
<rect>
<x>25</x>
<y>168</y>
<width>47</width>
<height>13</height>
</rect>
</property>
<property name="text">
<string>Paclen</string>
</property>
</widget>
<widget class="QLineEdit" name="Paclen">
<property name="geometry">
<rect>
<x>100</x>
<y>165</y>
<width>47</width>
<height>22</height>
</rect>
</property>
</widget>
<widget class="QLabel" name="label_26">
<property name="geometry">
<rect>
<x>265</x>
<y>168</y>
<width>66</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>MaxFrame</string>
</property>
</widget>
<widget class="QLineEdit" name="Maxframe">
<property name="geometry">
<rect>
<x>340</x>
<y>165</y>
<width>47</width>
<height>22</height>
</rect>
</property>
</widget>
<widget class="QLabel" name="label_27">
<property name="geometry">
<rect>
<x>25</x>
<y>202</y>
<width>47</width>
<height>13</height>
</rect>
</property>
<property name="text">
<string>Frack</string>
</property>
</widget>
<widget class="QLineEdit" name="Frack">
<property name="geometry">
<rect>
<x>100</x>
<y>199</y>
<width>36</width>
<height>22</height>
</rect>
</property>
</widget>
<widget class="QLabel" name="label_28">
<property name="geometry">
<rect>
<x>265</x>
<y>201</y>
<width>47</width>
<height>13</height>
</rect>
</property>
<property name="text">
<string>Retries</string>
</property>
</widget>
<widget class="QLineEdit" name="Retries">
<property name="geometry">
<rect>
<x>340</x>
<y>198</y>
<width>36</width>
<height>22</height>
</rect>
</property>
</widget>
</widget>
<resources/>
<connections>
<connection>
<sender>okButton</sender>
<signal>clicked()</signal>
<receiver>KISSDialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>278</x>
<y>253</y>
</hint>
<hint type="destinationlabel">
<x>96</x>
<y>254</y>
</hint>
</hints>
</connection>
<connection>
<sender>cancelButton</sender>
<signal>clicked()</signal>
<receiver>KISSDialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>369</x>
<y>253</y>
</hint>
<hint type="destinationlabel">
<x>179</x>
<y>282</y>
</hint>
</hints>
</connection>
</connections>
</ui>

140
ListenPort.ui Normal file
View File

@ -0,0 +1,140 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>ListenPort</class>
<widget class="QDialog" name="ListenPort">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>445</width>
<height>654</height>
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
</property>
<widget class="QWidget" name="verticalLayoutWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>431</width>
<height>301</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QFormLayout" name="formLayout">
<item row="2" column="0">
<widget class="QLabel" name="label">
<property name="minimumSize">
<size>
<width>100</width>
<height>30</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>100</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>Port</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLineEdit" name="portNo">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>100</width>
<height>30</height>
</size>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_2">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>CText</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QTextEdit" name="CText">
<property name="minimumSize">
<size>
<width>0</width>
<height>150</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>401</width>
<height>150</height>
</size>
</property>
</widget>
</item>
<item row="4" column="0">
<layout class="QVBoxLayout" name="verticalLayout_2"/>
</item>
<item row="4" column="1">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="minimumSize">
<size>
<width>0</width>
<height>50</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>50</height>
</size>
</property>
<property name="layoutDirection">
<enum>Qt::RightToLeft</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Save</set>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QCheckBox" name="Enabled">
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
</property>
<property name="text">
<string>Enable Listen </string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</widget>
<resources/>
<connections/>
</ui>

99
QtSoundModem.ini Normal file
View File

@ -0,0 +1,99 @@
[General]
HostParams0=127.0.0.1|8011|john|password|80001 1 1 0 1 0 0 1\r
HostParams1=|0|||
HostParams2=|0|||
HostParams3=|0|||
HostParams4=|0|||
HostParams5=|0|||
HostParams6=|0|||
HostParams7=|0|||
HostParams8=|0|||
HostParams9=|0|||
HostParams10=|0|||
HostParams11=|0|||
HostParams12=|0|||
HostParams13=|0|||
HostParams14=|0|||
HostParams15=|0|||
Split=50
ChatMode=1
Bells=1
StripLF=1
AlertBeep=1
ConnectBeep=1
CurrentHost=16
YAPPPath=
listenPort=8015
listenEnable=1
listenCText=
convUTF8=0
PTT=None
PTTBAUD=19200
PTTMode=19200
CATHex=1
PTTOffString=
PTTOnString=
pttGPIOPin=17
pttGPIOPinR=17
CM108Addr=0xD8C:0x08
HamLibPort=4532
HamLibHost=127.0.0.1
FLRigPort=12345
FLRigHost=127.0.0.1
AGWEnable=0
AGWMonEnable=0
AGWTermCall=
AGWBeaconDest=
AGWBeaconPath=
AGWBeaconInterval=0
AGWBeaconPorts=
AGWBeaconText=
AGWHost=127.0.0.1
AGWPort=8000
AGWPaclen=80
AGWToCalls=GM8BPQ-1, GM8BPQ-2, GM8BPQ, G8BPQ-2, G8B, G8BPQ-9,
KISSEnable=1
MYCALL=GM8BPQ
KISSHost=127.0.0.1
KISSPort=8102
KISSSerialPort=COM54
KISSBAUD=19200
VARAEnable=0
VARATermCall=
VARAHost=127.0.0.1
VARAPort=8300
VARAPath=C:\\VARA\\VARA.exe
VARAHostHF=127.0.0.1
VARAPortHF=8300
VARAPathHF=C:\\VARA\\VARA.exe
VARAHostFM=127.0.0.1
VARAPortFM=8300
VARAPathFM=C:\\VARA\\VARAFM.exe
VARAHostSAT=127.0.0.1
VARAPortSAT=8300
VARAPathSAT=C:\\VARA\\VARASAT.exe
VARA500=0
VARA2300=1
VARA2750=0
VARAHF=1
VARAFM=0
VARASAT=0
TabType=1 1 1 1 1 1 1 2 2 0
[AX25_A]
Retries=9
Maxframe=6
FrackTime=7
IdleTime=180
SlotTime=100
Persist=128
RespTime=1500
TXFrmMode=1
FrameCollector=6
ExcludeCallsigns=
ExcludeAPRSFrmType=
KISSOptimization=0
DynamicFrack=0
BitRecovery=0
IPOLL=80
MyDigiCall=

BIN
QtTermTCP.aps Normal file

Binary file not shown.

6146
QtTermTCP.cpp Normal file

File diff suppressed because it is too large Load Diff

260
QtTermTCP.h Normal file
View File

@ -0,0 +1,260 @@
#pragma once
#include <QMainWindow>
#include "ui_QtTermTCP.h"
//#include "ui_ListenPort.h"
//#include "ui_AGWParams.h"
//#include "ui_AGWConnect.h"
#include "ui_ColourConfig.h"
#include "ui_VARAConfig.h"
#include "ui_KISSConfig.h"
#include "QTextEdit"
#include "QSplitter"
#include "QLineEdit"
#include "QTcpSocket"
#include <QDataStream>
#include <QKeyEvent>
#include "QThread"
#include "QTcpServer"
#include "QMdiArea"
#include <QMdiSubWindow>
#include "QMessageBox"
#include "QTimer"
#include "QSettings"
#include "QThread"
#include <QFontDialog>
#include <QScrollBar>
#include <QFileDialog>
#include <QTabWidget>
#include <QMenuBar>
#include <QProcess>
#include <QtSerialPort/QSerialPort>
QT_BEGIN_NAMESPACE
class QComboBox;
class QLabel;
class QLineEdit;
class QPushButton;
class QTcpSocket;
class QNetworkSession;
class myTcpSocket : public QTcpSocket
{
public:
QWidget * Sess;
};
class Ui_ListenSession : public QMainWindow
{
Q_OBJECT
public:
explicit Ui_ListenSession(QWidget *Parent = 0) : QMainWindow(Parent) {}
~Ui_ListenSession();
int SessionType; // Type Mask - Term, Mon, Listen
int CurrentWidth;
int CurrentHeight; // Saved so can be restored after Cascade
QTextEdit *termWindow;
QTextEdit *monWindow;
QLineEdit *inputWindow;
myTcpSocket *clientSocket;
QAction * actActivate; // From active Windows menu
char * KbdStack[50];
int StackIndex;
QMdiSubWindow *sw; // The MdiSubwindow is the container for this session
int InputMode;
int SlowTimer;
int MonData;
int OutputSaveLen;
char OutputSave[16384];
int MonSaveLen;
char MonSave[4096];
char PortMonString[1024]; // 32 ports 32 Bytes
unsigned long long portmask;
int mtxparam;
int mcomparam;
int monUI;
int MonitorNODES;
int MonitorColour;
int CurrentHost;
int Tab; // Tab Index if Tabbed Mode
void * AGWSession; // Terinal sess - Need to cast to TAGWPort to use it
void * AGWMonSession;
void * KISSSession;
int KISSMode; // Connected or UI
char UIDEST[32];
char UIPATH[128];
protected:
private slots:
private:
};
class QtTermTCP : public QMainWindow
{
Q_OBJECT
public:
QtTermTCP(QWidget *parent = NULL);
void closeEvent(QCloseEvent * event);
static void setFonts();
~QtTermTCP();
private slots:
void Disconnect();
void doYAPPSend();
void doYAPPSetRX();
void menuChecked();
void Connect();
void displayError(QAbstractSocket::SocketError socketError);
void readyRead();
void LreturnPressed(Ui_ListenSession * LUI);
void LDisconnect(Ui_ListenSession * LUI);
void SetupHosts();
void MyTimerSlot();
void KISSTimerSlot();
void ListenSlot();
void AGWSlot();
void VARASlot();
void KISSSlot();
void deviceaccept();
void KISSaccept();
void KISSreject();
void devicereject();
void showContextMenuM(const QPoint &pt);
void showContextMenuT(const QPoint &pt);
void doQuit();
void onTEselectionChanged();
void onLEselectionChanged();
void setSplit();
void onNewConnection();
void onSocketStateChanged(QAbstractSocket::SocketState socketState);
void updateWindowMenu();
void doNewTerm();
void doNewMon();
void doNewCombined();
void doCascade();
void actActivate();
void xon_mdiArea_changed();
void doFonts();
void doMFonts();
void ConnecttoVARA();
void VARATimer();
void AGWdisplayError(QAbstractSocket::SocketError socketError);
void AGWreadyRead();
void onAGWSocketStateChanged(QAbstractSocket::SocketState socketState);
void VARAdisplayError(QAbstractSocket::SocketError socketError);
void VARAreadyRead();
void onVARASocketStateChanged(QAbstractSocket::SocketState socketState);
void KISSdisplayError(QAbstractSocket::SocketError socketError);
void KISSreadyRead();
void onKISSSocketStateChanged(QAbstractSocket::SocketState socketState);
int openSerialPort();
void readSerialData();
void handleError(QSerialPort::SerialPortError serialPortError);
void doColours();
void ColourPressed();
void Colouraccept();
void Colourreject();
QColor setColor(QColor Colour);
void VARADatadisplayError(QAbstractSocket::SocketError socketError);
void VARADatareadyRead();
void onVARADataSocketStateChanged(QAbstractSocket::SocketState socketState);
void HAMLIBdisplayError(QAbstractSocket::SocketError socketError);
void HAMLIBreadyRead();
void onHAMLIBSocketStateChanged(QAbstractSocket::SocketState socketState);
void ConnecttoHAMLIB();
void HAMLIBSetPTT(int PTTState);
void FLRigdisplayError(QAbstractSocket::SocketError socketError);
void FLRigreadyRead();
void onFLRigSocketStateChanged(QAbstractSocket::SocketState socketState);
void ConnecttoFLRig();
void FLRigSetPTT(int PTTState);
void CATChanged(bool State);
void PTTPortChanged(int Selected);
void OpenPTTPort();
void RadioPTT(bool PTTState);
void tabSelected(int);
void VARAHFChanged(bool state);
void VARAFMChanged(bool State);
void VARASATChanged(bool State);
void SetVARAParams();
protected:
bool eventFilter(QObject* obj, QEvent *event);
private:
void ConnecttoAGW();
void AGWTimer();
Ui::QtTermTCPClass ui;
QMenu *hostsubMenu;
QAction *closeAct;
QAction *closeAllAct;
QAction *tileAct;
QAction *cascadeAct;
QAction *nextAct;
QAction *previousAct;
QAction *windowMenuSeparatorAct;
QAction *newTermAct;
QAction *newMonAct;
QAction *newCombinedAct;
QAction *AGWAction;
QAction *VARAAction;
QAction *KISSAction;
QAction *quitAction;
QList<myTcpSocket*> _sockets;
QWidget *centralWidget;
void ConnecttoKISS();
void KISSTimer();
};
extern "C"
{
void EncodeSettingsLine(int n, char * String);
void DecodeSettingsLine(int n, char * String);
void WritetoOutputWindow(Ui_ListenSession * Sess, unsigned char * Buffer, int Len);
void WritetoOutputWindowEx(Ui_ListenSession * Sess, unsigned char * Buffer, int len, QTextEdit * termWindow, int *OutputSaveLen, char * OutputSave, QColor Colour);
void WritetoMonWindow(Ui_ListenSession * Sess, unsigned char * Buffer, int Len);
void ProcessReceivedData(Ui_ListenSession * Sess, unsigned char * Buffer, int len);
void SendTraceOptions(Ui_ListenSession * LUI);
void setTraceOff(Ui_ListenSession * Sess);
void SetPortMonLine(int i, char * Text, int visible, int enabled);
void SaveSettings();
void myBeep();
void YAPPSendFile(Ui_ListenSession * Sess, char * FN);
int SocketSend(Ui_ListenSession * Sess, char * Buffer, int len);
void SendTraceOptions(Ui_ListenSession * Sess);
int SocketFlush(Ui_ListenSession * Sess);
extern void mySleep(int ms);
extern void setTraceOff(Ui_ListenSession * Sess);
}
char * strlop(char * buf, char delim);
extern "C" void setMenus(int State);
void Send_AGW_Ds_Frame(void * AGW);

BIN
QtTermTCP.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 120 KiB

116
QtTermTCP.ini Normal file
View File

@ -0,0 +1,116 @@
[General]
HostParams0=127.0.0.1|8011|john|password|
geometry=@ByteArray(\x1\xd9\xd0\xcb\0\x3\0\0\0\0\0\xf9\0\0\0\x85\0\0\x4\x5\0\0\x3>\0\0\0\xf9\0\0\0\x85\0\0\x4\x5\0\0\x3>\0\0\0\0\0\0\0\0\x5\0\0\0\0\xf9\0\0\0\x85\0\0\x4\x5\0\0\x3>)
HostParams1=|0|||
windowState=@ByteArray(\0\0\0\xff\0\0\0\0\xfd\0\0\0\0\0\0\x3\r\0\0\x2z\0\0\0\x4\0\0\0\x4\0\0\0\b\0\0\0\b\xfc\0\0\0\x1\0\0\0\x3\0\0\0\x1\0\0\0\x16\0m\0\x61\0i\0n\0T\0o\0o\0l\0\x62\0\x61\0r\0\0\0\0\0\xff\xff\xff\xff\0\0\0\0\0\0\0\0)
HostParams2=|0|||
HostParams3=|0|||
HostParams4=|0|||
HostParams5=|0|||
HostParams6=|0|||
HostParams7=|0|||
HostParams8=|0|||
HostParams9=|0|||
HostParams10=|0|||
HostParams11=|0|||
HostParams12=|0|||
HostParams13=|0|||
HostParams14=|0|||
HostParams15=|0|||
Split=50
ChatMode=1
Bells=1
StripLF=1
AlertBeep=1
ConnectBeep=1
CurrentHost=0
YAPPPath=
listenPort=8015
listenEnable=1
listenCText=Hello\r
convUTF8=0
PTT=None
PTTBAUD=19200
PTTMode=19200
CATHex=1
PTTOffString=
PTTOnString=
pttGPIOPin=17
pttGPIOPinR=17
CM108Addr=0xD8C:0x08
HamLibPort=4532
HamLibHost=127.0.0.1
FLRigPort=12345
FLRigHost=127.0.0.1
AGWEnable=1
AGWMonEnable=1
AGWTermCall=
AGWBeaconDest=
AGWBeaconPath=
AGWBeaconInterval=0
AGWBeaconPorts=
AGWBeaconText=
AGWHost=127.0.0.1
AGWPort=8001
AGWPaclen=80
AGWToCalls=
KISSEnable=0
MYCALL=
KISSHost=127.0.0.1
KISSMode=0
KISSPort=8100
KISSSerialPort=None
KISSBAUD=19200
VARAEnable=0
VARATermCall=
VARAHost=127.0.0.1
VARAPort=8300
VARAPath=C:\\VARA\\VARA.exe
VARAHostHF=127.0.0.1
VARAPortHF=8300
VARAPathHF=C:\\VARA\\VARA.exe
VARAHostFM=127.0.0.1
VARAPortFM=8300
VARAPathFM=C:\\VARA\\VARAFM.exe
VARAHostSAT=127.0.0.1
VARAPortSAT=8300
VARAPathSAT=C:\\VARA\\VARASAT.exe
VARA500=0
VARA2300=1
VARA2750=0
VARAHF=1
VARAFM=0
VARASAT=0
TabType=1 1 1 1 1 1 1 2 2 0
monBackground=@Variant(\0\0\0\x43\x1\xff\xff\0\0\0\0\0\0\0\0)
monRxText=@Variant(\0\0\0\x43\x1\xff\xff\0\0\xff\xff\0\0\0\0)
monTxText=@Variant(\0\0\0\x43\x1\xff\xff\xff\xff\0\0\0\0\0\0)
monOtherText=@Variant(\0\0\0\x43\x1\xff\xff\0\0\0\0\0\0\0\0)
termBackground=@Variant(\0\0\0\x43\x1\xff\xff\0\0\0\0\0\0\0\0)
outputText=@Variant(\0\0\0\x43\x1\xff\xff\0\0\xff\xff\0\0\0\0)
EchoText=@Variant(\0\0\0\x43\x1\xff\xff\xff\xff\0\0\xff\xff\0\0)
WarningText=@Variant(\0\0\0\x43\x1\xff\xff\xff\xff\0\0\0\0\0\0)
inputBackground=@Variant(\0\0\0\x43\x1\xff\xff\xff\xff\xff\xff\xff\xff\0\0)
inputText=@Variant(\0\0\0\x43\x1\xff\xff\0\0\0\0\0\0\0\0)
TermMode=2
singlemodeFormat=3
Sessions="1|4, 0, 3, 136, 599, 932|"
[AX25_A]
Retries=10
Maxframe=4
Paclen=128
FrackTime=8
IdleTime=180
SlotTime=100
Persist=128
RespTime=1500
TXFrmMode=1
FrameCollector=6
ExcludeCallsigns=
ExcludeAPRSFrmType=
KISSOptimization=0
DynamicFrack=0
BitRecovery=0
IPOLL=80
MyDigiCall=

48
QtTermTCP.pro Normal file
View File

@ -0,0 +1,48 @@
QT += core gui
QT += network
QT += widgets
QT += serialport
TARGET = QtTermTCP
TEMPLATE = app
# The following define makes your compiler emit warnings if you use
# any feature of Qt which as been marked as deprecated (the exact warnings
# depend on your compiler). Please consult the documentation of the
# deprecated API in order to know how to port your code away from it.
DEFINES += QT_DEPRECATED_WARNINGS
# You can also make your code fail to compile if you use deprecated APIs.
# In order to do so, uncomment the following line.
# You can also select to disable deprecated APIs only up to a certain version of Qt.
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x050000 # disables all the APIs deprecated before Qt 6.0.0
SOURCES += main.cpp\
QtTermTCP.cpp\
TermTCPCommon.cpp\
TabDialog.cpp \
AGWCode.cpp \
ax25.c \
UZ7HOUtils.c \
ax25_l2.c\
utf8Routines.cpp
HEADERS += QtTermTCP.h\
TabDialog.h
FORMS += QtTermTCP.ui\
ListenPort.ui \
AGWParams.ui \
VARAConfig.ui \
KISSConfig.ui \
AGWConnect.ui
RESOURCES += QtTermTCP.qrc
RC_ICONS = QtTermTCP.ico
QMAKE_LFLAGS += -no-pie

38
QtTermTCP.pro.bak Normal file
View File

@ -0,0 +1,38 @@
QT += core gui
QT += network
QT += widgets
TARGET = QtTermTCP
TEMPLATE = app
# The following define makes your compiler emit warnings if you use
# any feature of Qt which as been marked as deprecated (the exact warnings
# depend on your compiler). Please consult the documentation of the
# deprecated API in order to know how to port your code away from it.
DEFINES += QT_DEPRECATED_WARNINGS
# You can also make your code fail to compile if you use deprecated APIs.
# In order to do so, uncomment the following line.
# You can also select to disable deprecated APIs only up to a certain version of Qt.
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x050000 # disables all the APIs deprecated before Qt 6.0.0
SOURCES += main.cpp\
QtTermTCP.cpp\
TermTCPCommon.cpp\
TabDialog.cpp
HEADERS += QtTermTCP.h\
TabDialog.h
FORMS += QtTermTCP.ui\
ListenPort.ui
RESOURCES += QtTermTCP.qrc
RC_ICONS = QtTermTCP.ico
QMAKE_LFLAGS += -no-pie

5
QtTermTCP.qrc Normal file
View File

@ -0,0 +1,5 @@
<RCC>
<qresource prefix="/QtTermTCP">
<file>QtTermTCP.ico</file>
</qresource>
</RCC>

BIN
QtTermTCP.rc Normal file

Binary file not shown.

25
QtTermTCP.sln Normal file
View File

@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.28307.102
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "QtTermTCP", "D:\BT Cloud\ActiveSource\QtTermTCP\QtTermTCP.vcxproj", "{B12702AD-ABFB-343A-A199-8E24837244A3}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x86 = Debug|x86
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{B12702AD-ABFB-343A-A199-8E24837244A3}.Debug|x86.ActiveCfg = Debug|Win32
{B12702AD-ABFB-343A-A199-8E24837244A3}.Debug|x86.Build.0 = Debug|Win32
{B12702AD-ABFB-343A-A199-8E24837244A3}.Release|x86.ActiveCfg = Release|Win32
{B12702AD-ABFB-343A-A199-8E24837244A3}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {DD1F8FD5-5375-4EFC-BBEE-8E35ABA15C82}
EndGlobalSection
EndGlobal

66
QtTermTCP.ui Normal file
View File

@ -0,0 +1,66 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>QtTermTCPClass</class>
<widget class="QMainWindow" name="QtTermTCPClass">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>781</width>
<height>698</height>
</rect>
</property>
<property name="font">
<font>
<family>Arial</family>
<pointsize>12</pointsize>
</font>
</property>
<property name="windowTitle">
<string>QtTermTCP</string>
</property>
<property name="windowIcon">
<iconset resource="QtTermTCP.qrc">
<normaloff>:/QtTermTCP/QtTermTCP.ico</normaloff>:/QtTermTCP/QtTermTCP.ico</iconset>
</property>
<widget class="QWidget" name="centralWidget">
<layout class="QGridLayout" name="gridLayout">
<property name="leftMargin">
<number>5</number>
</property>
<property name="topMargin">
<number>5</number>
</property>
<property name="rightMargin">
<number>5</number>
</property>
<property name="bottomMargin">
<number>5</number>
</property>
<item row="0" column="0">
<layout class="QVBoxLayout" name="verticalLayout">
<property name="spacing">
<number>6</number>
</property>
</layout>
</item>
</layout>
</widget>
<widget class="QStatusBar" name="statusBar"/>
<action name="actionListen">
<property name="text">
<string>Listen</string>
</property>
</action>
<action name="actionDisconnect">
<property name="text">
<string>Disconnect</string>
</property>
</action>
</widget>
<layoutdefault spacing="6" margin="11"/>
<resources>
<include location="QtTermTCP.qrc"/>
</resources>
<connections/>
</ui>

267
QtTermTCP.vcxproj Normal file
View File

@ -0,0 +1,267 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{14F3B24E-473C-324E-A99D-3B679FCF5F67}</ProjectGuid>
<RootNamespace>QtTermTCP</RootNamespace>
<Keyword>QtVS_v304</Keyword>
<WindowsTargetPlatformVersion>10.0.19041.0</WindowsTargetPlatformVersion>
<WindowsTargetPlatformMinVersion>10.0.19041.0</WindowsTargetPlatformMinVersion>
<QtMsBuild Condition="'$(QtMsBuild)'=='' or !Exists('$(QtMsBuild)\qt.targets')">$(MSBuildProjectDirectory)\QtMsBuild</QtMsBuild>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<PlatformToolset>v141</PlatformToolset>
<OutputDirectory>release\</OutputDirectory>
<ATLMinimizesCRunTimeLibraryUsage>false</ATLMinimizesCRunTimeLibraryUsage>
<CharacterSet>NotSet</CharacterSet>
<ConfigurationType>Application</ConfigurationType>
<IntermediateDirectory>release\</IntermediateDirectory>
<PrimaryOutput>QtTermTCP</PrimaryOutput>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<PlatformToolset>v141</PlatformToolset>
<OutputDirectory>debug\</OutputDirectory>
<ATLMinimizesCRunTimeLibraryUsage>false</ATLMinimizesCRunTimeLibraryUsage>
<CharacterSet>NotSet</CharacterSet>
<ConfigurationType>Application</ConfigurationType>
<IntermediateDirectory>debug\</IntermediateDirectory>
<PrimaryOutput>QtTermTCP</PrimaryOutput>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<Target Name="QtMsBuildNotFound" BeforeTargets="CustomBuild;ClCompile" Condition="!Exists('$(QtMsBuild)\qt.targets') or !Exists('$(QtMsBuild)\qt.props')">
<Message Importance="High" Text="QtMsBuild: could not locate qt.targets, qt.props; project may not build correctly." />
</Target>
<ImportGroup Label="ExtensionSettings" />
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<ImportGroup Condition="Exists('$(QtMsBuild)\qt_defaults.props')">
<Import Project="$(QtMsBuild)\qt_defaults.props" />
</ImportGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
<IntDir>$(SolutionDir)Intermed\$(Platform)\$(Configuration)\</IntDir>
<TargetName>QtTermTCP</TargetName>
<IgnoreImportLibrary>true</IgnoreImportLibrary>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
<IntDir>$(SolutionDir)Intermed\$(Platform)\$(Configuration)\</IntDir>
<TargetName>QtTermTCP</TargetName>
<IgnoreImportLibrary>true</IgnoreImportLibrary>
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<PropertyGroup Label="QtSettings" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<QtInstall>msvc2017</QtInstall>
<QtModules>core;network;gui;widgets;serialport</QtModules>
</PropertyGroup>
<PropertyGroup Label="QtSettings" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<QtInstall>msvc2017</QtInstall>
<QtModules>core;network;gui;widgets;serialport</QtModules>
</PropertyGroup>
<ImportGroup Condition="Exists('$(QtMsBuild)\qt.props')">
<Import Project="$(QtMsBuild)\qt.props" />
</ImportGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<AdditionalIncludeDirectories>GeneratedFiles\$(ConfigurationName);GeneratedFiles;.;release;/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalOptions>-Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -Zc:referenceBinding -Zc:__cplusplus -w34100 -w34189 -w44996 -w44456 -w44457 -w44458 %(AdditionalOptions)</AdditionalOptions>
<AssemblerListingLocation>$(IntDir)</AssemblerListingLocation>
<BrowseInformation>false</BrowseInformation>
<DebugInformationFormat>None</DebugInformationFormat>
<DisableSpecificWarnings>4577;4467;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<ExceptionHandling>Sync</ExceptionHandling>
<ObjectFileName>$(IntDir)</ObjectFileName>
<Optimization>MaxSpeed</Optimization>
<PreprocessorDefinitions>_WINDOWS;UNICODE;_UNICODE;WIN32;_ENABLE_EXTENDED_ALIGNED_STORAGE;QT_DEPRECATED_WARNINGS;QT_DISABLE_DEPRECATED_BEFORE=0x050000;NDEBUG;QT_NO_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessToFile>false</PreprocessToFile>
<ProgramDataBaseFileName>
</ProgramDataBaseFileName>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<SuppressStartupBanner>true</SuppressStartupBanner>
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
<WarningLevel>Level3</WarningLevel>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile>
<Link>
<AdditionalDependencies>shell32.lib;setupapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>C:\opensslx86\lib;C:\Utils\my_sql\mysql-5.7.25-win32\lib;C:\Utils\postgresqlx86\pgsql\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalOptions>-no-pie "/MANIFESTDEPENDENCY:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' publicKeyToken='6595b64144ccf1df' language='*' processorArchitecture='*'" %(AdditionalOptions)</AdditionalOptions>
<DataExecutionPrevention>true</DataExecutionPrevention>
<GenerateDebugInformation>false</GenerateDebugInformation>
<IgnoreImportLibrary>true</IgnoreImportLibrary>
<LinkIncremental>false</LinkIncremental>
<OptimizeReferences>true</OptimizeReferences>
<OutputFile>$(OutDir)\QtTermTCP.exe</OutputFile>
<RandomizedBaseAddress>true</RandomizedBaseAddress>
<SubSystem>Windows</SubSystem>
<SuppressStartupBanner>true</SuppressStartupBanner>
</Link>
<Midl>
<DefaultCharType>Unsigned</DefaultCharType>
<EnableErrorChecks>None</EnableErrorChecks>
<WarningLevel>0</WarningLevel>
</Midl>
<ResourceCompile>
<PreprocessorDefinitions>_WINDOWS;UNICODE;_UNICODE;WIN32;_ENABLE_EXTENDED_ALIGNED_STORAGE;QT_DEPRECATED_WARNINGS;QT_DISABLE_DEPRECATED_BEFORE=0x050000;NDEBUG;QT_NO_DEBUG;QT_WIDGETS_LIB;QT_GUI_LIB;QT_NETWORK_LIB;QT_SERIALPORT_LIB;QT_CORE_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ResourceCompile>
<QtMoc>
<CompilerFlavor>msvc</CompilerFlavor>
<Include>./$(Configuration)/moc_predefs.h</Include>
<ExecutionDescription>Moc'ing %(Identity)...</ExecutionDescription>
<DynamicSource>output</DynamicSource>
<QtMocDir>$(IntDir)</QtMocDir>
<QtMocFileName>moc_%(Filename).cpp</QtMocFileName>
</QtMoc>
<QtRcc>
<InitFuncName>QtTermTCP</InitFuncName>
<Compression>default</Compression>
<ExecutionDescription>Rcc'ing %(Identity)...</ExecutionDescription>
<QtRccDir>$(IntDir)</QtRccDir>
<QtRccFileName>qrc_%(Filename).cpp</QtRccFileName>
</QtRcc>
<QtUic>
<ExecutionDescription>Uic'ing %(Identity)...</ExecutionDescription>
<QtUicDir>$(IntDir)</QtUicDir>
<QtUicFileName>ui_%(Filename).h</QtUicFileName>
</QtUic>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<AdditionalIncludeDirectories>GeneratedFiles\$(ConfigurationName);GeneratedFiles;.;debug;/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalOptions>-Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -Zc:referenceBinding -Zc:__cplusplus -w34100 -w34189 -w44996 -w44456 -w44457 -w44458 %(AdditionalOptions)</AdditionalOptions>
<AssemblerListingLocation>$(IntDir)</AssemblerListingLocation>
<BrowseInformation>false</BrowseInformation>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<DisableSpecificWarnings>4577;4467;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<ExceptionHandling>Sync</ExceptionHandling>
<ObjectFileName>$(intdir)</ObjectFileName>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>_WINDOWS;UNICODE;_UNICODE;WIN32;_ENABLE_EXTENDED_ALIGNED_STORAGE;QT_DEPRECATED_WARNINGS;QT_DISABLE_DEPRECATED_BEFORE=0x050000;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessToFile>false</PreprocessToFile>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<SuppressStartupBanner>true</SuppressStartupBanner>
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
<WarningLevel>Level3</WarningLevel>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile>
<Link>
<AdditionalDependencies>shell32.lib;setupapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>C:\opensslx86\lib;C:\Utils\my_sql\mysql-5.7.25-win32\lib;C:\Utils\postgresqlx86\pgsql\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalOptions>-no-pie "/MANIFESTDEPENDENCY:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' publicKeyToken='6595b64144ccf1df' language='*' processorArchitecture='*'" %(AdditionalOptions)</AdditionalOptions>
<DataExecutionPrevention>true</DataExecutionPrevention>
<GenerateDebugInformation>true</GenerateDebugInformation>
<IgnoreImportLibrary>true</IgnoreImportLibrary>
<OutputFile>$(OutDir)\QtTermTCP.exe</OutputFile>
<RandomizedBaseAddress>true</RandomizedBaseAddress>
<SubSystem>Windows</SubSystem>
<SuppressStartupBanner>true</SuppressStartupBanner>
</Link>
<Midl>
<DefaultCharType>Unsigned</DefaultCharType>
<EnableErrorChecks>None</EnableErrorChecks>
<WarningLevel>0</WarningLevel>
</Midl>
<ResourceCompile>
<PreprocessorDefinitions>_WINDOWS;UNICODE;_UNICODE;WIN32;_ENABLE_EXTENDED_ALIGNED_STORAGE;QT_DEPRECATED_WARNINGS;QT_DISABLE_DEPRECATED_BEFORE=0x050000;QT_WIDGETS_LIB;QT_GUI_LIB;QT_NETWORK_LIB;QT_SERIALPORT_LIB;QT_CORE_LIB;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ResourceCompile>
<QtMoc>
<CompilerFlavor>msvc</CompilerFlavor>
<Include>./$(Configuration)/moc_predefs.h</Include>
<ExecutionDescription>Moc'ing %(Identity)...</ExecutionDescription>
<DynamicSource>output</DynamicSource>
<QtMocDir>$(IntDir)</QtMocDir>
<QtMocFileName>moc_%(Filename).cpp</QtMocFileName>
</QtMoc>
<QtRcc>
<InitFuncName>QtTermTCP</InitFuncName>
<Compression>default</Compression>
<ExecutionDescription>Rcc'ing %(Identity)...</ExecutionDescription>
<QtRccDir>$(IntDir)</QtRccDir>
<QtRccFileName>qrc_%(Filename).cpp</QtRccFileName>
</QtRcc>
<QtUic>
<ExecutionDescription>Uic'ing %(Identity)...</ExecutionDescription>
<QtUicDir>$(IntDir)</QtUicDir>
<QtUicFileName>ui_%(Filename).h</QtUicFileName>
</QtUic>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="AGWCode.cpp" />
<ClCompile Include="hid.c" />
<ClCompile Include="QtTermTCP.cpp" />
<ClCompile Include="TabDialog.cpp" />
<ClCompile Include="TermTCPCommon.cpp" />
<ClCompile Include="UZ7HOUtils.c" />
<ClCompile Include="ax25.c" />
<ClCompile Include="ax25_l2.c" />
<ClCompile Include="main.cpp" />
<ClCompile Include="utf8Routines.cpp" />
</ItemGroup>
<ItemGroup>
<QtMoc Include="QtTermTCP.h">
</QtMoc>
<QtMoc Include="TabDialog.h">
</QtMoc>
</ItemGroup>
<ItemGroup>
<CustomBuild Include="debug\moc_predefs.h.cbt">
<FileType>Document</FileType>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(QTDIR)\mkspecs\features\data\dummy.cpp;%(AdditionalInputs)</AdditionalInputs>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">cl -Bx"$(QTDIR)\bin\qmake.exe" -nologo -Zc:wchar_t -FS -Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -Zc:referenceBinding -Zc:__cplusplus -Zi -MDd -W3 -w34100 -w34189 -w44996 -w44456 -w44457 -w44458 -wd4577 -wd4467 -E $(QTDIR)\mkspecs\features\data\dummy.cpp 2&gt;NUL &gt;debug\moc_predefs.h</Command>
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Generate moc_predefs.h</Message>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">debug\moc_predefs.h;%(Outputs)</Outputs>
</CustomBuild>
<CustomBuild Include="release\moc_predefs.h.cbt">
<FileType>Document</FileType>
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(QTDIR)\mkspecs\features\data\dummy.cpp;%(AdditionalInputs)</AdditionalInputs>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">cl -Bx"$(QTDIR)\bin\qmake.exe" -nologo -Zc:wchar_t -FS -Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -Zc:referenceBinding -Zc:__cplusplus -O2 -MD -W3 -w34100 -w34189 -w44996 -w44456 -w44457 -w44458 -wd4577 -wd4467 -E $(QTDIR)\mkspecs\features\data\dummy.cpp 2&gt;NUL &gt;release\moc_predefs.h</Command>
<Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Generate moc_predefs.h</Message>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">release\moc_predefs.h;%(Outputs)</Outputs>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
</CustomBuild>
</ItemGroup>
<ItemGroup>
<QtUic Include="AGWConnect.ui">
</QtUic>
<QtUic Include="AGWParams.ui">
</QtUic>
<QtUic Include="ColourConfig.ui" />
<QtUic Include="KISSConfig.ui">
</QtUic>
<QtUic Include="ListenPort.ui">
</QtUic>
<QtUic Include="QtTermTCP.ui">
</QtUic>
<QtUic Include="VARAConfig.ui">
</QtUic>
</ItemGroup>
<ItemGroup>
<None Include="QtTermTCP.ico" />
<QtRcc Include="QtTermTCP.qrc">
</QtRcc>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include=".\QtTermTCP_resource.rc" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Condition="Exists('$(QtMsBuild)\qt.targets')">
<Import Project="$(QtMsBuild)\qt.targets" />
</ImportGroup>
<ImportGroup Label="ExtensionTargets" />
</Project>

131
QtTermTCP.vcxproj.filters Normal file
View File

@ -0,0 +1,131 @@
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Form Files">
<UniqueIdentifier>{99349809-55BA-4b9d-BF79-8FDBB0286EB3}</UniqueIdentifier>
<Extensions>ui</Extensions>
<ParseFiles>false</ParseFiles>
</Filter>
<Filter Include="Form Files">
<UniqueIdentifier>{99349809-55BA-4b9d-BF79-8FDBB0286EB3}</UniqueIdentifier>
<Extensions>ui</Extensions>
<ParseFiles>false</ParseFiles>
</Filter>
<Filter Include="Generated Files">
<UniqueIdentifier>{71ED8ED8-ACB9-4CE9-BBE1-E00B30144E11}</UniqueIdentifier>
<Extensions>cpp;c;cxx;moc;h;def;odl;idl;res;</Extensions>
</Filter>
<Filter Include="Generated Files">
<UniqueIdentifier>{71ED8ED8-ACB9-4CE9-BBE1-E00B30144E11}</UniqueIdentifier>
<Extensions>cpp;c;cxx;moc;h;def;odl;idl;res;</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{D9D6E242-F8AF-46E4-B9FD-80ECBC20BA3E}</UniqueIdentifier>
<Extensions>qrc;*</Extensions>
<ParseFiles>false</ParseFiles>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{D9D6E242-F8AF-46E4-B9FD-80ECBC20BA3E}</UniqueIdentifier>
<Extensions>qrc;*</Extensions>
<ParseFiles>false</ParseFiles>
</Filter>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="AGWCode.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="QtTermTCP.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="TabDialog.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="TermTCPCommon.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="UZ7HOUtils.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="ax25.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="ax25_l2.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="main.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="utf8Routines.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="hid.c">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<QtMoc Include="QtTermTCP.h">
<Filter>Header Files</Filter>
</QtMoc>
<QtMoc Include="TabDialog.h">
<Filter>Header Files</Filter>
</QtMoc>
</ItemGroup>
<ItemGroup>
<CustomBuild Include="debug\moc_predefs.h.cbt">
<Filter>Generated Files</Filter>
</CustomBuild>
<CustomBuild Include="release\moc_predefs.h.cbt">
<Filter>Generated Files</Filter>
</CustomBuild>
</ItemGroup>
<ItemGroup>
<QtUic Include="AGWConnect.ui">
<Filter>Form Files</Filter>
</QtUic>
<QtUic Include="AGWParams.ui">
<Filter>Form Files</Filter>
</QtUic>
<QtUic Include="KISSConfig.ui">
<Filter>Form Files</Filter>
</QtUic>
<QtUic Include="ListenPort.ui">
<Filter>Form Files</Filter>
</QtUic>
<QtUic Include="QtTermTCP.ui">
<Filter>Form Files</Filter>
</QtUic>
<QtUic Include="VARAConfig.ui">
<Filter>Form Files</Filter>
</QtUic>
<QtUic Include="ColourConfig.ui">
<Filter>Form Files</Filter>
</QtUic>
</ItemGroup>
<ItemGroup>
<None Include="QtTermTCP.ico">
<Filter>Resource Files</Filter>
</None>
<QtRcc Include="QtTermTCP.qrc">
<Filter>Resource Files</Filter>
</QtRcc>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include=".\QtTermTCP_resource.rc" />
</ItemGroup>
</Project>

16
QtTermTCP.vcxproj.user Normal file
View File

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup />
<PropertyGroup Label="QtSettings" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<QtLastBackgroundBuild>2022-05-19T07:28:47.9186341Z</QtLastBackgroundBuild>
</PropertyGroup>
<PropertyGroup Label="QtSettings" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<QtLastBackgroundBuild>2022-05-19T07:28:58.9302359Z</QtLastBackgroundBuild>
</PropertyGroup>
<PropertyGroup Label="QtSettings" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<QtLastBackgroundBuild>2022-08-30T07:53:00.9638702Z</QtLastBackgroundBuild>
</PropertyGroup>
<PropertyGroup Label="QtSettings" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<QtLastBackgroundBuild>2022-08-30T07:53:22.4120059Z</QtLastBackgroundBuild>
</PropertyGroup>
</Project>

BIN
QtTermTCP52.zip Normal file

Binary file not shown.

37
QtTermTCP_resource.rc Normal file
View File

@ -0,0 +1,37 @@
#include <windows.h>
IDI_ICON1 ICON DISCARDABLE "C:\\Users\\John\\OneDrive\\Dev\\Source\\QT\\QtTermTCP\\QtTermTCP.ico"
VS_VERSION_INFO VERSIONINFO
FILEVERSION 0,0,0,0
PRODUCTVERSION 0,0,0,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS VS_FF_DEBUG
#else
FILEFLAGS 0x0L
#endif
FILEOS VOS__WINDOWS32
FILETYPE VFT_DLL
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904b0"
BEGIN
VALUE "CompanyName", "\0"
VALUE "FileDescription", "\0"
VALUE "FileVersion", "0.0.0.0\0"
VALUE "LegalCopyright", "\0"
VALUE "OriginalFilename", "QtTermTCP.exe\0"
VALUE "ProductName", "QtTermTCP\0"
VALUE "ProductVersion", "0.0.0.0\0"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x0409, 1200
END
END
/* End of Version info */

85
TCPHostConfig.ui Normal file
View File

@ -0,0 +1,85 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Dialog</class>
<widget class="QDialog" name="Dialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
</rect>
</property>
<property name="windowTitle">
<string>TCP Host Config</string>
</property>
<property name="windowIcon">
<iconset>
<normaloff>QtTermTCP.ico</normaloff>QtTermTCP.ico</iconset>
</property>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="geometry">
<rect>
<x>30</x>
<y>240</y>
<width>341</width>
<height>32</height>
</rect>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Save</set>
</property>
<property name="centerButtons">
<bool>true</bool>
</property>
</widget>
<widget class="QTextEdit" name="Host">
<property name="geometry">
<rect>
<x>184</x>
<y>44</y>
<width>104</width>
<height>23</height>
</rect>
</property>
</widget>
</widget>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>Dialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>248</x>
<y>254</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>Dialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>

1127
TabDialog.cpp Normal file

File diff suppressed because it is too large Load Diff

208
TabDialog.h Normal file
View File

@ -0,0 +1,208 @@
#ifndef TABDIALOG_H
#define TABDIALOG_H
#include <QDialog>
#include <QLineEdit>
#include <QComboBox>
#include <QListWidget>
#include <QFontComboBox>
#include <QTextEdit>
#include <QCheckBox>
#include <QFormLayout>
#include <QVBoxLayout>
#include <QGroupBox>
#include <QRadioButton>
class QDialogButtonBox;
class QFileInfo;
class QTabWidget;
namespace Ui {
class TabDialog;
}
class ListenDialog: public QDialog
{
Q_OBJECT
public:
explicit ListenDialog(QWidget *parent = 0);
~ListenDialog();
private slots:
void myaccept();
void myreject();
public:
QVBoxLayout *verticalLayout;
QFormLayout *formLayout;
QLineEdit *portNo;
QTextEdit *CText;
QVBoxLayout *verticalLayout_2;
QDialogButtonBox *buttonBox;
QCheckBox *Enabled;
};
class TabDialog : public QDialog
{
Q_OBJECT
public:
explicit TabDialog(QWidget *parent = 0);
~TabDialog();
private slots:
void myaccept();
void myreject();
private:
// Ui::TabDialog *ui;
QDialogButtonBox *buttonBox;
};
class AGWDialog : public QDialog
{
Q_OBJECT
public:
explicit AGWDialog(QWidget *parent = 0);
~AGWDialog();
public:
QPushButton *okButton;
QPushButton *cancelButton;
private slots:
void myaccept();
void myreject();
private:
// Ui::TabDialog *ui;
QDialogButtonBox *buttonBox;
};
class AGWConnect : public QDialog
{
Q_OBJECT
public:
explicit AGWConnect(QWidget *parent = 0);
~AGWConnect();
public:
QLineEdit * wCallFrom;
QComboBox * wCallTo;
QLineEdit * Digis;
QListWidget * RadioPorts;
private slots:
void myaccept();
void myreject();
private:
// Ui::TabDialog *ui;
QDialogButtonBox *buttonBox;
};
class VARAConnect : public QDialog
{
Q_OBJECT
public:
explicit VARAConnect(QWidget *parent = 0);
~VARAConnect();
public:
QLineEdit * wCallFrom;
QComboBox * wCallTo;
QLineEdit * Digis;
QListWidget * RadioPorts;
private slots:
void myaccept();
void myreject();
private:
// Ui::TabDialog *ui;
QDialogButtonBox *buttonBox;
};
class KISSConnect : public QDialog
{
Q_OBJECT
public:
explicit KISSConnect(QWidget *parent = 0);
~KISSConnect();
public:
QLineEdit * wCallFrom;
QComboBox * wCallTo;
QLineEdit * Digis;
QLineEdit * UIDest;
QListWidget * RadioPorts;
QHBoxLayout *mylayout;
QRadioButton * Connected;
QRadioButton * UIMode;
private slots:
void myaccept();
void myreject();
private:
// Ui::TabDialog *ui;
QDialogButtonBox *buttonBox;
};
class fontDialog : public QDialog
{
Q_OBJECT
public:
explicit fontDialog(int Menu, QWidget *parent = 0);
~fontDialog();
public:
QFontComboBox *font;
QComboBox *style;
QComboBox *size;
QTextEdit * sample;
QFont workingFont;
int workingSize;
int Menuflag; // Set if menu font
private slots:
void myaccept();
void myreject();
void fontchanged(QFont);
void stylechanged();
void sizechanged();
private:
QDialogButtonBox *buttonBox;
};
#endif
class myResize : public QObject
{
Q_OBJECT
protected:
bool eventFilter(QObject *obj, QEvent *event) override;
};

1091
TermTCPCommon.cpp Normal file

File diff suppressed because it is too large Load Diff

320
UZ7HOUtils.c Normal file
View File

@ -0,0 +1,320 @@
/*
Copyright (C) 2019-2020 Andrei Kopanchuk UZ7HO
This file is part of QtSoundModem
QtSoundModem is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
QtSoundModem is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with QtSoundModem. If not, see http://www.gnu.org/licenses
*/
// UZ7HO Soundmodem Port by John Wiseman G8BPQ
#include "ax25.h"
// TStringlist And String emulation Functions
// Dephi seems to mix starting counts at 0 or 1. I'll try making everything
// base zero.
// Initialise a list
void CreateStringList(TStringList * List)
{
List->Count = 0;
List->Items = 0;
}
int Count(TStringList * List)
{
return List->Count;
}
string * newString()
{
// Creates and Initialises a string
UCHAR * ptr = malloc(sizeof(string)); // Malloc Data separately so it can be ralloc'ed
string * New = (string *)ptr;
New->Length = 0;
New->AllocatedLength = 256;
New->Data = malloc(256);
return New;
}
void initString(string * S)
{
S->Length = 0;
S->AllocatedLength = 256;
S->Data = malloc(256);
}
void initTStringList(TStringList* T)
{
//string * New = newString();
T->Count = 0;
T->Items = NULL;
//Add(T, New);
}
TStringList * newTStringList()
{
TStringList * T = (TStringList *) malloc(sizeof(TStringList));
string * New = newString();
T->Count = 0;
T->Items = NULL;
Add(T, New);
return T;
}
void freeString(string * Msg)
{
if (Msg->Data)
free(Msg->Data);
free(Msg);
}
string * Strings(TStringList * Q, int Index)
{
if (Index >= Q->Count)
return NULL;
return Q->Items[Index];
}
int Add(TStringList * Q, string * Entry)
{
Q->Items = realloc(Q->Items,(Q->Count + 1) * sizeof(void *));
Q->Items[Q->Count++] = Entry;
return (Q->Count);
}
void mydelete(string * Source, int StartChar, int Count)
{
//Description
//The Delete procedure deletes up to Count characters from the passed parameter Source string starting
//from position StartChar.
if (StartChar > Source->Length)
return;
int left = Source->Length - StartChar;
if (Count > left)
Count = left;
memmove(&Source->Data[StartChar], &Source->Data[StartChar + Count], left - Count);
Source->Length -= Count;
}
void Delete(TStringList * Q, int Index)
{
// Remove item at Index and move rest up list
// Index starts at zero
if (Index >= Q->Count)
return;
// We should free it, so user must duplicate msg if needed after delete
freeString(Q->Items[Index]);
Q->Count--;
while (Index < Q->Count)
{
Q->Items[Index] = Q->Items[Index + 1];
Index++;
}
}
void setlength(string * Msg, int Count)
{
// Set length, allocating more space if needed
if (Count > Msg->AllocatedLength)
{
Msg->AllocatedLength = Count + 256;
Msg->Data = realloc(Msg->Data, Msg->AllocatedLength);
}
Msg->Length = Count;
}
string * stringAdd(string * Msg, UCHAR * Chars, int Count)
{
// Add Chars to string
if (Msg->Length + Count > Msg->AllocatedLength)
{
Msg->AllocatedLength += Count + 256;
Msg->Data = realloc(Msg->Data, Msg->AllocatedLength);
}
memcpy(&Msg->Data[Msg->Length], Chars, Count);
Msg->Length += Count;
return Msg;
}
void Clear(TStringList * Q)
{
int i = 0;
if (Q->Items == NULL)
return;
while (Q->Count)
{
freeString(Q->Items[i++]);
Q->Count--;
}
free(Q->Items);
Q->Items = NULL;
}
// procedure move ( const SourcePointer; var DestinationPointer; CopyCount : Integer ) ;
// Description
// The move procedure is a badly named method of copying a section of memory from one place to another.
// CopyCount bytes are copied from storage referenced by SourcePointer and written to DestinationPointer
void move(UCHAR * SourcePointer, UCHAR * DestinationPointer, int CopyCount)
{
memmove(DestinationPointer, SourcePointer, CopyCount);
}
void fmove(float * SourcePointer, float * DestinationPointer, int CopyCount)
{
memmove(DestinationPointer, SourcePointer, CopyCount);
}
//Description
//The copy function has 2 forms. In the first, it creates a new string from part of an existing string. In the second, it creates a new array from part of an existing array.
//1.String copy
//The first character of a string has index = 1.
//Up to Count characters are copied from the StartChar of the Source string to the returned string.
//Less than Count characters if the end of the Source string is encountered before Count characters have been copied.
string * copy(string * Source, int StartChar, int Count)
{
string * NewString = newString();
int end = StartChar + Count;
if (end > Source->Length)
Count = Source->Length - StartChar;
memcpy(NewString->Data, &Source->Data[StartChar], Count);
NewString->Length = Count;
return NewString;
}
// Duplicate from > to
void Assign(TStringList * to, TStringList * from)
{
int i;
Clear(to);
if (from->Count == 0)
return;
// Duplicate each item
for (i = 0; i < from->Count; i++)
{
string * new = newString();
stringAdd(new, from->Items[i]->Data, from->Items[i]->Length);
Add(to, new);
}
}
string * duplicateString(string * in)
{
string * new = newString();
stringAdd(new, in->Data, in->Length);
return new;
}
double pila(double x)
{
//x : = frac(x); The frac function returns the fractional part of a floating point number.
double whole;
double rem;
rem = modf(x, &whole); // returns fraction, writes whole to whole
if (rem != rem)
rem = 0;
if (rem > 0.5)
rem = 1 - rem;
return 2 * rem;
}
boolean compareStrings(string * a, string * b)
{
if (a->Length == b->Length && memcmp(a->Data, b->Data, a->Length) == 0)
return TRUE;
return FALSE;
}
// This looks for a string in a stringlist. Returns index if found, otherwise -1
int my_indexof(TStringList * l, string * s)
{
int i;
for (i = 0; i < l->Count; i++)
{
// Need to compare count and data - C doesn't allow struct compare
if (l->Items[i]->Length == s->Length && memcmp(l->Items[i]->Data, s->Data, s->Length) == 0)
return i;
}
return -1;
}

148
VARA.ui Normal file
View File

@ -0,0 +1,148 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>AGWConnectDkg</class>
<widget class="QDialog" name="AGWConnectDkg">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>500</width>
<height>400</height>
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
</property>
<widget class="QWidget" name="verticalLayoutWidget">
<property name="geometry">
<rect>
<x>10</x>
<y>10</y>
<width>480</width>
<height>380</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QFormLayout" name="formLayout_2">
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Call From </string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="CallFrom"/>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Call To </string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="CallTo">
<property name="editable">
<bool>true</bool>
</property>
<property name="insertPolicy">
<enum>QComboBox::NoInsert</enum>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Digis</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLineEdit" name="Digis"/>
</item>
</layout>
</item>
<item>
<widget class="QLabel" name="label_4">
<property name="text">
<string>Radio Ports</string>
</property>
</widget>
</item>
<item>
<widget class="QListWidget" name="RadioPorts"/>
</item>
<item>
<layout class="QHBoxLayout">
<property name="spacing">
<number>6</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QPushButton" name="okButton">
<property name="text">
<string>OK</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="cancelButton">
<property name="text">
<string>Cancel</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</widget>
<resources/>
<connections>
<connection>
<sender>okButton</sender>
<signal>clicked()</signal>
<receiver>AGWConnectDkg</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>278</x>
<y>253</y>
</hint>
<hint type="destinationlabel">
<x>96</x>
<y>254</y>
</hint>
</hints>
</connection>
<connection>
<sender>cancelButton</sender>
<signal>clicked()</signal>
<receiver>AGWConnectDkg</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>369</x>
<y>253</y>
</hint>
<hint type="destinationlabel">
<x>179</x>
<y>282</y>
</hint>
</hints>
</connection>
</connections>
</ui>

566
VARAConfig.ui Normal file
View File

@ -0,0 +1,566 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Dialog</class>
<widget class="QDialog" name="Dialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>571</width>
<height>517</height>
</rect>
</property>
<property name="windowTitle">
<string>VARA Configuration</string>
</property>
<widget class="QWidget" name="layoutWidget">
<property name="geometry">
<rect>
<x>170</x>
<y>460</y>
<width>211</width>
<height>33</height>
</rect>
</property>
<layout class="QHBoxLayout">
<property name="spacing">
<number>6</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QPushButton" name="okButton">
<property name="text">
<string>OK</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="cancelButton">
<property name="text">
<string>Cancel</string>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QGroupBox" name="TNCInfo">
<property name="geometry">
<rect>
<x>10</x>
<y>120</y>
<width>537</width>
<height>123</height>
</rect>
</property>
<property name="title">
<string>TNC Setup</string>
</property>
<widget class="QLineEdit" name="Host">
<property name="geometry">
<rect>
<x>130</x>
<y>22</y>
<width>101</width>
<height>22</height>
</rect>
</property>
</widget>
<widget class="QLineEdit" name="Port">
<property name="geometry">
<rect>
<x>130</x>
<y>54</y>
<width>47</width>
<height>22</height>
</rect>
</property>
</widget>
<widget class="QLineEdit" name="Path">
<property name="geometry">
<rect>
<x>130</x>
<y>90</y>
<width>391</width>
<height>22</height>
</rect>
</property>
</widget>
<widget class="QLabel" name="label_11">
<property name="geometry">
<rect>
<x>16</x>
<y>24</y>
<width>47</width>
<height>13</height>
</rect>
</property>
<property name="text">
<string>Host</string>
</property>
</widget>
<widget class="QLabel" name="label_12">
<property name="geometry">
<rect>
<x>16</x>
<y>53</y>
<width>47</width>
<height>22</height>
</rect>
</property>
<property name="text">
<string>Port</string>
</property>
</widget>
<widget class="QLabel" name="label_13">
<property name="geometry">
<rect>
<x>16</x>
<y>89</y>
<width>47</width>
<height>22</height>
</rect>
</property>
<property name="text">
<string>Path</string>
</property>
</widget>
</widget>
<widget class="QGroupBox" name="groupBox_3">
<property name="geometry">
<rect>
<x>8</x>
<y>280</y>
<width>541</width>
<height>181</height>
</rect>
</property>
<property name="title">
<string>PTT Port</string>
</property>
<widget class="QComboBox" name="PTTPort">
<property name="geometry">
<rect>
<x>150</x>
<y>20</y>
<width>111</width>
<height>22</height>
</rect>
</property>
</widget>
<widget class="QLabel" name="label_6">
<property name="geometry">
<rect>
<x>20</x>
<y>23</y>
<width>131</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>Select PTT Port</string>
</property>
</widget>
<widget class="QLabel" name="PTTOnLab">
<property name="geometry">
<rect>
<x>20</x>
<y>80</y>
<width>121</width>
<height>22</height>
</rect>
</property>
<property name="text">
<string>PTT On String</string>
</property>
</widget>
<widget class="QLineEdit" name="PTTOn">
<property name="geometry">
<rect>
<x>150</x>
<y>83</y>
<width>247</width>
<height>22</height>
</rect>
</property>
</widget>
<widget class="QLineEdit" name="PTTOff">
<property name="geometry">
<rect>
<x>150</x>
<y>114</y>
<width>247</width>
<height>22</height>
</rect>
</property>
</widget>
<widget class="QLabel" name="PTTOffLab">
<property name="geometry">
<rect>
<x>20</x>
<y>112</y>
<width>121</width>
<height>22</height>
</rect>
</property>
<property name="text">
<string>PTT Off String</string>
</property>
</widget>
<widget class="QLabel" name="GPIOLab">
<property name="geometry">
<rect>
<x>20</x>
<y>52</y>
<width>111</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>GPIO Pin Left</string>
</property>
</widget>
<widget class="QLineEdit" name="GPIOLeft">
<property name="geometry">
<rect>
<x>150</x>
<y>50</y>
<width>25</width>
<height>20</height>
</rect>
</property>
</widget>
<widget class="QLineEdit" name="GPIORight">
<property name="geometry">
<rect>
<x>310</x>
<y>50</y>
<width>25</width>
<height>20</height>
</rect>
</property>
</widget>
<widget class="QLabel" name="GPIOLab2">
<property name="geometry">
<rect>
<x>165</x>
<y>50</y>
<width>83</width>
<height>18</height>
</rect>
</property>
<property name="text">
<string>GPIO Pin Right</string>
</property>
</widget>
<widget class="QLabel" name="CATLabel">
<property name="geometry">
<rect>
<x>18</x>
<y>50</y>
<width>121</width>
<height>18</height>
</rect>
</property>
<property name="text">
<string>CAT Port Speed</string>
</property>
</widget>
<widget class="QLineEdit" name="CATSpeed">
<property name="geometry">
<rect>
<x>150</x>
<y>50</y>
<width>47</width>
<height>20</height>
</rect>
</property>
</widget>
<widget class="QRadioButton" name="RTSDTR">
<property name="geometry">
<rect>
<x>290</x>
<y>22</y>
<width>131</width>
<height>18</height>
</rect>
</property>
<property name="text">
<string>RTS/DTR</string>
</property>
<attribute name="buttonGroup">
<string notr="true">buttonGroup_2</string>
</attribute>
</widget>
<widget class="QRadioButton" name="CAT">
<property name="geometry">
<rect>
<x>420</x>
<y>22</y>
<width>121</width>
<height>18</height>
</rect>
</property>
<property name="text">
<string>CAT</string>
</property>
<attribute name="buttonGroup">
<string notr="true">buttonGroup_2</string>
</attribute>
</widget>
<widget class="QLineEdit" name="VIDPID">
<property name="geometry">
<rect>
<x>150</x>
<y>50</y>
<width>121</width>
<height>20</height>
</rect>
</property>
</widget>
<widget class="QLabel" name="CM108Label">
<property name="geometry">
<rect>
<x>20</x>
<y>50</y>
<width>111</width>
<height>18</height>
</rect>
</property>
<property name="text">
<string>CM108 VID/PID</string>
</property>
</widget>
<widget class="QRadioButton" name="CATHex">
<property name="geometry">
<rect>
<x>290</x>
<y>50</y>
<width>131</width>
<height>18</height>
</rect>
</property>
<property name="text">
<string>Hex Strings</string>
</property>
<attribute name="buttonGroup">
<string notr="true">buttonGroup</string>
</attribute>
</widget>
<widget class="QRadioButton" name="CATText">
<property name="geometry">
<rect>
<x>420</x>
<y>50</y>
<width>131</width>
<height>18</height>
</rect>
</property>
<property name="text">
<string>Text Strings</string>
</property>
<attribute name="buttonGroup">
<string notr="true">buttonGroup</string>
</attribute>
</widget>
</widget>
<widget class="QLineEdit" name="TermCall">
<property name="geometry">
<rect>
<x>140</x>
<y>44</y>
<width>113</width>
<height>22</height>
</rect>
</property>
</widget>
<widget class="QLabel" name="label">
<property name="geometry">
<rect>
<x>16</x>
<y>42</y>
<width>131</width>
<height>22</height>
</rect>
</property>
<property name="text">
<string>Terminal Callsign</string>
</property>
</widget>
<widget class="QLabel" name="label_14">
<property name="geometry">
<rect>
<x>18</x>
<y>12</y>
<width>161</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string>Enable VARA Interface</string>
</property>
</widget>
<widget class="QCheckBox" name="VARAEnable">
<property name="geometry">
<rect>
<x>180</x>
<y>10</y>
<width>23</width>
<height>25</height>
</rect>
</property>
<property name="layoutDirection">
<enum>Qt::RightToLeft</enum>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QGroupBox" name="VARAMode">
<property name="geometry">
<rect>
<x>270</x>
<y>10</y>
<width>131</width>
<height>101</height>
</rect>
</property>
<property name="title">
<string>VARA Mode</string>
</property>
<widget class="QRadioButton" name="VARAHF">
<property name="geometry">
<rect>
<x>10</x>
<y>20</y>
<width>121</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>VARA HF</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
<attribute name="buttonGroup">
<string notr="true">buttonGroup_4</string>
</attribute>
</widget>
<widget class="QRadioButton" name="VARAFM">
<property name="geometry">
<rect>
<x>10</x>
<y>43</y>
<width>121</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>VARA FM</string>
</property>
<attribute name="buttonGroup">
<string notr="true">buttonGroup_4</string>
</attribute>
</widget>
<widget class="QRadioButton" name="VARASAT">
<property name="geometry">
<rect>
<x>10</x>
<y>66</y>
<width>121</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>VARA SAT</string>
</property>
<attribute name="buttonGroup">
<string notr="true">buttonGroup_4</string>
</attribute>
</widget>
</widget>
<widget class="QGroupBox" name="HFMode">
<property name="geometry">
<rect>
<x>410</x>
<y>10</y>
<width>131</width>
<height>101</height>
</rect>
</property>
<property name="title">
<string>VARA HF BW</string>
</property>
<widget class="QRadioButton" name="VARA500">
<property name="geometry">
<rect>
<x>10</x>
<y>20</y>
<width>101</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>500 Hz</string>
</property>
<attribute name="buttonGroup">
<string notr="true">buttonGroup_3</string>
</attribute>
</widget>
<widget class="QRadioButton" name="VARA2300">
<property name="geometry">
<rect>
<x>10</x>
<y>43</y>
<width>101</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>2300 Hz</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
<attribute name="buttonGroup">
<string notr="true">buttonGroup_3</string>
</attribute>
</widget>
<widget class="QRadioButton" name="VARA2750">
<property name="geometry">
<rect>
<x>10</x>
<y>66</y>
<width>101</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string>2750 Hz</string>
</property>
<attribute name="buttonGroup">
<string notr="true">buttonGroup_3</string>
</attribute>
</widget>
</widget>
</widget>
<resources/>
<connections/>
<buttongroups>
<buttongroup name="buttonGroup"/>
<buttongroup name="buttonGroup_2"/>
<buttongroup name="buttonGroup_3"/>
<buttongroup name="buttonGroup_4"/>
</buttongroups>
</ui>

2987
ax25.c Normal file

File diff suppressed because it is too large Load Diff

304
ax25.h Normal file
View File

@ -0,0 +1,304 @@
// ax.25 code for QtTERMTCP KISS Mode
// based on SoundModem/QtSoundModem ax.25 code
// The underlying code allows for up to four KISS ports, but at the moment
// the config and user interface only supports 1
// The code supports KISS over a Serial port or TCP connection
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <stdio.h>
#include <ctype.h>
#include <time.h>
#define UNUSED(x) (void)(x)
#define single float
#define boolean int
#define Byte unsigned char // 0 to 255
#define Word unsigned short // 0 to 65,535
#define SmallInt short // -32,768 to 32,767
#define LongWord unsigned int // 0 to 4,294,967,295
// Int6 : Cardinal; // 0 to 4,294,967,295
#define LongInt int // -2,147,483,648 to 2,147,483,647
#define Integer int // -2,147,483,648 to 2,147,483,647
//#define Int64 long long // -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807
//#define Byte unsigned char // 0 to 255
#define word unsigned short // 0 to 65,535
#define smallint short // -32,768 to 32,767
#define longword unsigned int // 0 to 4,294,967,295
// Int6 : Cardinal; // 0 to 4,294,967,295
#define longint int // -2,147,483,648 to 2,147,483,647
#define integer int // -2,147,483,648 to 2,147,483,647
typedef unsigned long ULONG;
#define UCHAR unsigned char
#define UINT unsigned int
#define BOOL int
#define TRUE 1
#define FALSE 0
#define FEND 0xc0
#define FESC 0xDB
#define TFEND 0xDC
#define TFESC 0xDD
#define port_num 32 // ?? Max AGW sessions
#define PKT_ERR 15 // Minimum packet size, bytes
#define I_MAX 7 // Maximum number of packets
// Status flags
#define STAT_NO_LINK 0
#define STAT_LINK 1
#define STAT_CHK_LINK 2
#define STAT_WAIT_ANS 3
#define STAT_TRY_LINK 4
#define STAT_TRY_UNLINK 5
// Ñmd,Resp,Poll,Final,Digipeater flags
#define SET_P 1
#define SET_F 0
#define SET_C 1
#define SET_R 0
#define SET_NO_RPT 0
#define SET_RPT 1
// Frame ID flags
#define I_FRM 0
#define S_FRM 1
#define U_FRM 2
#define I_I 0
#define S_RR 1
#define S_RNR 5
#define S_REJ 9
#define S_SREJ 0x0D
#define U_SABM 47
#define U_DISC 67
#define U_DM 15
#define U_UA 99
#define U_FRMR 135
#define U_UI 3
// PID flags
#define PID_X25 0x01 // 00000001-CCIT X25 PLP
#define PID_SEGMENT 0x08 // 00001000-Segmentation fragment
#define PID_TEXNET 0xC3 // 11000011-TEXNET Datagram Protocol
#define PID_LQ 0xC4 // 11001000-Link Quality Protocol
#define PID_APPLETALK 0xCA // 11001010-Appletalk
#define PID_APPLEARP 0xCB // 11001011-Appletalk ARP
#define PID_IP 0xCC // 11001100-ARPA Internet Protocol
#define PID_ARP 0xCD // 11001101-ARPA Address Resolution Protocol
#define PID_NET_ROM 0xCF // 11001111-NET/ROM
#define FX25_LOAD 1
#define MODE_OUR 0
#define MODE_OTHER 1
#define MODE_RETRY 2
#define TIMER_FREE 0
#define TIMER_BUSY 1
#define TIMER_OFF 2
#define TIMER_EVENT_ON 3
#define TIMER_EVENT_OFF 4
typedef struct string_T
{
unsigned char * Data;
int Length;
int AllocatedLength; // A reasonable sized block is allocated at the start to speed up adding chars
}string;
typedef struct TStringList_T
{
int Count;
string ** Items;
} TStringList;
typedef struct AGWUser_t
{
void *socket;
string * data_in;
TStringList AGW_frame_buf;
boolean Monitor;
boolean Monitor_raw;
boolean reportFreqAndModem; // Can report modem and frequency to host
} AGWUser;
typedef struct TAX25Info_t
{
longint stat_s_pkt;
longint stat_s_byte;
longint stat_r_pkt;
longint stat_r_byte;
longint stat_r_fc;
longint stat_fec_count;
time_t stat_begin_ses;
time_t stat_end_ses;
longint stat_l_r_byte;
longint stat_l_s_byte;
} TAX25Info;
typedef struct TAX25Port_t
{
Byte hi_vs;
Byte vs;
Byte vr;
Byte PID;
TStringList in_data_buf;
TStringList frm_collector;
string frm_win[8];
string out_data_buf;
word t1;
word t2;
word t3;
Byte i_lo;
Byte i_hi;
word n1;
word n2;
word IPOLL_cnt;
TStringList frame_buf; //áóôåð êàäðîâ íà ïåðåäà÷ó
TStringList I_frame_buf;
Byte status;
word clk_frack;
char corrcall[10];
char mycall[10];
UCHAR digi[56];
UCHAR Path[80]; // Path in ax25 format - added to save building it each time
UCHAR ReversePath[80];
int snd_ch; // Simplifies parameter passing
int port;
int pathLen;
void * socket;
void * Sess;
char kind[16];
TAX25Info info;
} TAX25Port;
typedef struct TKISSMode_t
{
string * data_in;
void * Socket; // Used as a key
// Not sure what rest are used for. Seems to be one per channel
TStringList buffer[4]; // Outgoing Frames
} TKISSMode;
// Dephi emulation functions
string * Strings(TStringList * Q, int Index);
void Clear(TStringList * Q);
int Count(TStringList * List);
string * newString();
string * copy(string * Source, int StartChar, int Count);
TStringList * newTStringList();
void freeString(string * Msg);
void initString(string * S);
void initTStringList(TStringList* T);
// Two delete() This is confusing!!
// Not really - one acts on String, other TStringList
void Delete(TStringList * Q, int Index);
void mydelete(string * Source, int StartChar, int Count);
void move(UCHAR * SourcePointer, UCHAR * DestinationPointer, int CopyCount);
void fmove(float * SourcePointer, float * DestinationPointer, int CopyCount);
void setlength(string * Msg, int Count); // Set string length
string * stringAdd(string * Msg, UCHAR * Chars, int Count); // Extend string
void Assign(TStringList * to, TStringList * from); // Duplicate from to to
string * duplicateString(string * in);
int my_indexof(TStringList * l, string * s);
boolean compareStrings(string * a, string * b);
int Add(TStringList * Q, string * Entry);
void Debugprintf(const char * format, ...);
void ax25_info_init(TAX25Port * AX25Sess);
void clr_frm_win(TAX25Port * AX25Sess);
void decode_frame(Byte * frame, int len, Byte * path, string * data,
Byte * pid, Byte * nr, Byte * ns, Byte * f_type, Byte * f_id,
Byte * rpt, Byte * pf, Byte * cr);
#ifdef __cplusplus
extern "C" void KISSSendtoServer(myTcpSocket* Socket, char * Data, int Length);
extern "C" void monitor_frame(int snd_ch, string * frame, char * code, int tx, int excluded);
extern "C" void WriteDebugLog(char * Mess);
extern "C" void SendtoTerm(Ui_ListenSession * Sess, char * Msg, int Len);
extern "C" void ClearSessLabel(Ui_ListenSession * Sess);
extern "C" void rst_timer(TAX25Port * AX25Sess);
extern "C" void Send_UI(int port, Byte PID, char * CallFrom, char *CallTo, Byte * Msg, int MsgLen);
#else
void monitor_frame(int snd_ch, string * frame, char * code, int tx, int excluded);
void SendtoTerm(void * Sess, char * Msg, int Len);
void ClearSessLabel(void * Sess);
void WriteDebugLog(char * Mess);
void AX25_disc(TAX25Port * AX25Sess, Byte mode);
void rst_timer(TAX25Port * AX25Sess);
void Send_UI(int port, Byte PID, char * CallFrom, char *CallTo, Byte * Msg, int MsgLen);
#endif
BOOL ConvToAX25(char * callsign, unsigned char * ax25call);
int ConvFromAX25(unsigned char * incall, char * outcall);
void reverse_addr(Byte * path, Byte * revpath, int Len);
void set_DM(int snd_ch, Byte * path);
void set_link(TAX25Port * AX25Sess, UCHAR * axpath);
boolean is_last_digi(Byte *path);
boolean is_correct_path(Byte * path, Byte pid);
int number_digi(unsigned char * path);
void AX25_conn(TAX25Port * AX25Sess, int snd_ch, Byte mode);
void write_ax25_info(TAX25Port * AX25Sess);
void rst_values(TAX25Port * AX25Sess);
#ifdef __cplusplus
extern "C"
{
#endif
extern boolean dyn_frack[4];
extern Byte recovery[4];
extern Byte users[4];
extern int resptime[4];
extern int slottime[4];
extern int persist[4];
extern int kisspaclen[4];
extern int fracks[4];
extern int frack_time[4];
extern int idletime[4];
extern int redtime[4];
extern int IPOLL[4];
extern int maxframe[4];
extern int TXFrmMode[4];
extern char MyDigiCall[4][512];
extern char exclude_callsigns[4][512];
extern char exclude_APRS_frm[4][512];
extern TStringList list_exclude_callsigns[4];
extern TStringList list_exclude_APRS_frm[4];
extern TStringList list_digi_callsigns[4];
extern int max_frame_collector[4];
extern boolean KISS_opt[4];
extern TAX25Port AX25Port[4][port_num];
extern TStringList KISS_acked[];
extern TStringList KISS_iacked[];
#ifdef __cplusplus
}
#endif

1726
ax25_l2.c Normal file

File diff suppressed because it is too large Load Diff

910
hid.c Normal file
View File

@ -0,0 +1,910 @@
/*******************************************************
HIDAPI - Multi-Platform library for
communication with HID devices.
Alan Ott
Signal 11 Software
8/22/2009
Copyright 2009, All Rights Reserved.
At the discretion of the user of this library,
this software may be licensed under the terms of the
GNU Public License v3, a BSD-Style license, or the
original HIDAPI license as outlined in the LICENSE.txt,
LICENSE-gpl3.txt, LICENSE-bsd.txt, and LICENSE-orig.txt
files located at the root of the source distribution.
These files may also be found in the public source
code repository located at:
http://github.com/signal11/hidapi .
********************************************************/
// Hacked about a bit for BPQ32. John Wiseman G8BPQ April 2018
#include <windows.h>
#ifndef _NTDEF_
typedef LONG NTSTATUS;
#endif
#ifdef __MINGW32__
#include <ntdef.h>
#include <winbase.h>
#endif
#ifdef __CYGWIN__
#include <ntdef.h>
#define _wcsdup wcsdup
#endif
//#define HIDAPI_USE_DDK
#ifdef __cplusplus
extern "C" {
#endif
#include <setupapi.h>
#include <winioctl.h>
#ifdef HIDAPI_USE_DDK
#include <hidsdi.h>
#endif
// Copied from inc/ddk/hidclass.h, part of the Windows DDK.
#define HID_OUT_CTL_CODE(id) \
CTL_CODE(FILE_DEVICE_KEYBOARD, (id), METHOD_OUT_DIRECT, FILE_ANY_ACCESS)
#define IOCTL_HID_GET_FEATURE HID_OUT_CTL_CODE(100)
#ifdef __cplusplus
} // extern "C"
#endif
#include <stdio.h>
#include <stdlib.h>
#include "hidapi.h"
#ifdef _MSC_VER
// Thanks Microsoft, but I know how to use strncpy().
#pragma warning(disable:4996)
#endif
#ifdef __cplusplus
extern "C" {
#endif
#ifndef HIDAPI_USE_DDK
// Since we're not building with the DDK, and the HID header
// files aren't part of the SDK, we have to define all this
// stuff here. In lookup_functions(), the function pointers
// defined below are set.
typedef struct _HIDD_ATTRIBUTES{
ULONG Size;
USHORT VendorID;
USHORT ProductID;
USHORT VersionNumber;
} HIDD_ATTRIBUTES, *PHIDD_ATTRIBUTES;
typedef USHORT USAGE;
typedef struct _HIDP_CAPS {
USAGE Usage;
USAGE UsagePage;
USHORT InputReportByteLength;
USHORT OutputReportByteLength;
USHORT FeatureReportByteLength;
USHORT Reserved[17];
USHORT fields_not_used_by_hidapi[10];
} HIDP_CAPS, *PHIDP_CAPS;
typedef char* HIDP_PREPARSED_DATA;
#define HIDP_STATUS_SUCCESS 0x0
typedef BOOLEAN(__stdcall *HidD_GetAttributes_)(HANDLE device, PHIDD_ATTRIBUTES attrib);
typedef BOOLEAN(__stdcall *HidD_GetSerialNumberString_)(HANDLE device, PVOID buffer, ULONG buffer_len);
typedef BOOLEAN(__stdcall *HidD_GetManufacturerString_)(HANDLE handle, PVOID buffer, ULONG buffer_len);
typedef BOOLEAN(__stdcall *HidD_GetProductString_)(HANDLE handle, PVOID buffer, ULONG buffer_len);
typedef BOOLEAN(__stdcall *HidD_SetFeature_)(HANDLE handle, PVOID data, ULONG length);
typedef BOOLEAN(__stdcall *HidD_GetFeature_)(HANDLE handle, PVOID data, ULONG length);
typedef BOOLEAN(__stdcall *HidD_GetIndexedString_)(HANDLE handle, ULONG string_index, PVOID buffer, ULONG buffer_len);
typedef BOOLEAN(__stdcall *HidD_GetPreparsedData_)(HANDLE handle, HIDP_PREPARSED_DATA **preparsed_data);
typedef BOOLEAN(__stdcall *HidD_FreePreparsedData_)(HIDP_PREPARSED_DATA *preparsed_data);
typedef BOOLEAN(__stdcall *HidP_GetCaps_)(HIDP_PREPARSED_DATA *preparsed_data, HIDP_CAPS *caps);
static HidD_GetAttributes_ HidD_GetAttributes;
static HidD_GetSerialNumberString_ HidD_GetSerialNumberString;
static HidD_GetManufacturerString_ HidD_GetManufacturerString;
static HidD_GetProductString_ HidD_GetProductString;
static HidD_SetFeature_ HidD_SetFeature;
static HidD_GetFeature_ HidD_GetFeature;
static HidD_GetIndexedString_ HidD_GetIndexedString;
static HidD_GetPreparsedData_ HidD_GetPreparsedData;
static HidD_FreePreparsedData_ HidD_FreePreparsedData;
static HidP_GetCaps_ HidP_GetCaps;
static HMODULE lib_handle = NULL;
static BOOLEAN initialized = FALSE;
#endif // HIDAPI_USE_DDK
struct hid_device_ {
HANDLE device_handle;
BOOLEAN blocking;
int input_report_length;
void *last_error_str;
DWORD last_error_num;
BOOLEAN read_pending;
char *read_buf;
OVERLAPPED ol;
};
static hid_device *new_hid_device()
{
hid_device *dev = (hid_device*) calloc(1, sizeof(hid_device));
dev->device_handle = INVALID_HANDLE_VALUE;
dev->blocking = TRUE;
dev->input_report_length = 0;
dev->last_error_str = NULL;
dev->last_error_num = 0;
dev->read_pending = FALSE;
dev->read_buf = NULL;
memset(&dev->ol, 0, sizeof(dev->ol));
dev->ol.hEvent = CreateEvent(NULL, FALSE, FALSE /*inital state f=nonsignaled*/, NULL);
return dev;
}
static void register_error(hid_device *device, const char *op)
{
WCHAR *ptr, *msg;
FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER |
FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_IGNORE_INSERTS,
NULL,
GetLastError(),
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
(LPWSTR)&msg, 0/*sz*/,
NULL);
// Get rid of the CR and LF that FormatMessage() sticks at the
// end of the message. Thanks Microsoft!
ptr = msg;
while (*ptr) {
if (*ptr == '\r') {
*ptr = 0x0000;
break;
}
ptr++;
}
// Store the message off in the Device entry so that
// the hid_error() function can pick it up.
LocalFree(device->last_error_str);
device->last_error_str = msg;
}
#ifndef HIDAPI_USE_DDK
static int lookup_functions()
{
lib_handle = LoadLibraryA("hid.dll");
if (lib_handle) {
#define RESOLVE(x) x = (x##_)GetProcAddress(lib_handle, #x); if (!x) return -1;
RESOLVE(HidD_GetAttributes);
RESOLVE(HidD_GetSerialNumberString);
RESOLVE(HidD_GetManufacturerString);
RESOLVE(HidD_GetProductString);
RESOLVE(HidD_SetFeature);
RESOLVE(HidD_GetFeature);
RESOLVE(HidD_GetIndexedString);
RESOLVE(HidD_GetPreparsedData);
RESOLVE(HidD_FreePreparsedData);
RESOLVE(HidP_GetCaps);
#undef RESOLVE
}
else
return -1;
return 0;
}
#endif
static HANDLE open_device(const char *path)
{
HANDLE handle;
/* First, try to open with sharing mode turned off. This will make it so
that a HID device can only be opened once. This is to be consistent
with the behavior on the other platforms. */
handle = CreateFileA(path,
GENERIC_WRITE |GENERIC_READ,
0, /*share mode*/
NULL,
OPEN_EXISTING,
FILE_FLAG_OVERLAPPED,//FILE_ATTRIBUTE_NORMAL,
0);
if (handle == INVALID_HANDLE_VALUE) {
/* Couldn't open the device. Some devices must be opened
with sharing enabled (even though they are only opened once),
so try it here. */
handle = CreateFileA(path,
GENERIC_WRITE |GENERIC_READ,
FILE_SHARE_READ|FILE_SHARE_WRITE, /*share mode*/
NULL,
OPEN_EXISTING,
FILE_FLAG_OVERLAPPED,//FILE_ATTRIBUTE_NORMAL,
0);
}
return handle;
}
int HID_API_EXPORT hid_init(void)
{
#ifndef HIDAPI_USE_DDK
if (!initialized) {
if (lookup_functions() < 0) {
hid_exit();
return -1;
}
initialized = TRUE;
}
#endif
return 0;
}
int HID_API_EXPORT hid_exit(void)
{
#ifndef HIDAPI_USE_DDK
if (lib_handle)
FreeLibrary(lib_handle);
lib_handle = NULL;
initialized = FALSE;
#endif
return 0;
}
struct hid_device_info HID_API_EXPORT * HID_API_CALL hid_enumerate(unsigned short vendor_id, unsigned short product_id)
{
BOOLEAN res;
struct hid_device_info *root = NULL; // return object
struct hid_device_info *cur_dev = NULL;
// Windows objects for interacting with the driver.
GUID InterfaceClassGuid = {0x4d1e55b2, 0xf16f, 0x11cf, {0x88, 0xcb, 0x00, 0x11, 0x11, 0x00, 0x00, 0x30} };
SP_DEVINFO_DATA devinfo_data;
SP_DEVICE_INTERFACE_DATA device_interface_data;
SP_DEVICE_INTERFACE_DETAIL_DATA_A *device_interface_detail_data = NULL;
HDEVINFO device_info_set = INVALID_HANDLE_VALUE;
int device_index = 0;
if (hid_init() < 0)
return NULL;
// Initialize the Windows objects.
devinfo_data.cbSize = sizeof(SP_DEVINFO_DATA);
device_interface_data.cbSize = sizeof(SP_DEVICE_INTERFACE_DATA);
// Get information for all the devices belonging to the HID class.
device_info_set = SetupDiGetClassDevsA(&InterfaceClassGuid, NULL, NULL, DIGCF_PRESENT | DIGCF_DEVICEINTERFACE);
// Iterate over each device in the HID class, looking for the right one.
for (;;) {
HANDLE write_handle = INVALID_HANDLE_VALUE;
DWORD required_size = 0;
HIDD_ATTRIBUTES attrib;
res = SetupDiEnumDeviceInterfaces(device_info_set,
NULL,
&InterfaceClassGuid,
device_index,
&device_interface_data);
if (!res) {
// A return of FALSE from this function means that
// there are no more devices.
break;
}
// Call with 0-sized detail size, and let the function
// tell us how long the detail struct needs to be. The
// size is put in &required_size.
res = SetupDiGetDeviceInterfaceDetailA(device_info_set,
&device_interface_data,
NULL,
0,
&required_size,
NULL);
// Allocate a long enough structure for device_interface_detail_data.
device_interface_detail_data = (SP_DEVICE_INTERFACE_DETAIL_DATA_A*) malloc(required_size);
device_interface_detail_data->cbSize = sizeof(SP_DEVICE_INTERFACE_DETAIL_DATA_A);
// Get the detailed data for this device. The detail data gives us
// the device path for this device, which is then passed into
// CreateFile() to get a handle to the device.
res = SetupDiGetDeviceInterfaceDetailA(device_info_set,
&device_interface_data,
device_interface_detail_data,
required_size,
NULL,
NULL);
if (!res) {
//register_error(dev, "Unable to call SetupDiGetDeviceInterfaceDetail");
// Continue to the next device.
goto cont;
}
//wprintf(L"HandleName: %s\n", device_interface_detail_data->DevicePath);
// Open a handle to the device
write_handle = open_device(device_interface_detail_data->DevicePath);
// Check validity of write_handle.
if (write_handle == INVALID_HANDLE_VALUE) {
// Unable to open the device.
//register_error(dev, "CreateFile");
goto cont_close;
}
// Get the Vendor ID and Product ID for this device.
attrib.Size = sizeof(HIDD_ATTRIBUTES);
HidD_GetAttributes(write_handle, &attrib);
//wprintf(L"Product/Vendor: %x %x\n", attrib.ProductID, attrib.VendorID);
// Check the VID/PID to see if we should add this
// device to the enumeration list.
if ((vendor_id == 0x0 && product_id == 0x0) ||
(attrib.VendorID == vendor_id && attrib.ProductID == product_id))
{
#define WSTR_LEN 512
const char *str;
struct hid_device_info *tmp;
HIDP_PREPARSED_DATA *pp_data = NULL;
HIDP_CAPS caps;
BOOLEAN res;
NTSTATUS nt_res;
wchar_t wstr[WSTR_LEN]; // TODO: Determine Size
int len;
/* VID/PID match. Create the record. */
tmp = (struct hid_device_info*) calloc(1, sizeof(struct hid_device_info));
if (cur_dev) {
cur_dev->next = tmp;
}
else {
root = tmp;
}
cur_dev = tmp;
// Get the Usage Page and Usage for this device.
res = HidD_GetPreparsedData(write_handle, &pp_data);
if (res) {
nt_res = HidP_GetCaps(pp_data, &caps);
if (nt_res == HIDP_STATUS_SUCCESS) {
cur_dev->usage_page = caps.UsagePage;
cur_dev->usage = caps.Usage;
}
HidD_FreePreparsedData(pp_data);
}
/* Fill out the record */
cur_dev->next = NULL;
str = device_interface_detail_data->DevicePath;
if (str) {
len = (int)strlen(str);
cur_dev->path = (char*) calloc(len+1, sizeof(char));
strncpy(cur_dev->path, str, len+1);
cur_dev->path[len] = '\0';
}
else
cur_dev->path = NULL;
/* Serial Number */
res = HidD_GetSerialNumberString(write_handle, wstr, sizeof(wstr));
wstr[WSTR_LEN-1] = 0x0000;
if (res) {
cur_dev->serial_number = _wcsdup(wstr);
}
/* Manufacturer String */
res = HidD_GetManufacturerString(write_handle, wstr, sizeof(wstr));
wstr[WSTR_LEN-1] = 0x0000;
if (res) {
cur_dev->manufacturer_string = _wcsdup(wstr);
}
/* Product String */
res = HidD_GetProductString(write_handle, wstr, sizeof(wstr));
wstr[WSTR_LEN-1] = 0x0000;
if (res) {
cur_dev->product_string = _wcsdup(wstr);
}
/* VID/PID */
cur_dev->vendor_id = attrib.VendorID;
cur_dev->product_id = attrib.ProductID;
/* Release Number */
cur_dev->release_number = attrib.VersionNumber;
/* Interface Number. It can sometimes be parsed out of the path
on Windows if a device has multiple interfaces. See
http://msdn.microsoft.com/en-us/windows/hardware/gg487473 or
search for "Hardware IDs for HID Devices" at MSDN. If it's not
in the path, it's set to -1. */
cur_dev->interface_number = -1;
if (cur_dev->path) {
char *interface_component = strstr(cur_dev->path, "&mi_");
if (interface_component) {
char *hex_str = interface_component + 4;
char *endptr = NULL;
cur_dev->interface_number = strtol(hex_str, &endptr, 16);
if (endptr == hex_str) {
/* The parsing failed. Set interface_number to -1. */
cur_dev->interface_number = -1;
}
}
}
}
cont_close:
CloseHandle(write_handle);
cont:
// We no longer need the detail data. It can be freed
free(device_interface_detail_data);
device_index++;
}
// Close the device information handle.
SetupDiDestroyDeviceInfoList(device_info_set);
return root;
}
void HID_API_EXPORT HID_API_CALL hid_free_enumeration(struct hid_device_info *devs)
{
// TODO: Merge this with the Linux version. This function is platform-independent.
struct hid_device_info *d = devs;
while (d) {
struct hid_device_info *next = d->next;
free(d->path);
free(d->serial_number);
free(d->manufacturer_string);
free(d->product_string);
free(d);
d = next;
}
}
HID_API_EXPORT hid_device * HID_API_CALL hid_open(unsigned short vendor_id, unsigned short product_id, wchar_t *serial_number)
{
// TODO: Merge this functions with the Linux version. This function should be platform independent.
struct hid_device_info *devs, *cur_dev;
const char *path_to_open = NULL;
hid_device *handle = NULL;
devs = hid_enumerate(vendor_id, product_id);
cur_dev = devs;
while (cur_dev) {
if (cur_dev->vendor_id == vendor_id &&
cur_dev->product_id == product_id) {
if (serial_number) {
if (wcscmp(serial_number, cur_dev->serial_number) == 0) {
path_to_open = cur_dev->path;
break;
}
}
else {
path_to_open = cur_dev->path;
break;
}
}
cur_dev = cur_dev->next;
}
if (path_to_open) {
/* Open the device */
handle = hid_open_path(path_to_open);
}
hid_free_enumeration(devs);
return handle;
}
HID_API_EXPORT hid_device * HID_API_CALL hid_open_path(const char *path)
{
hid_device *dev;
HIDP_CAPS caps;
HIDP_PREPARSED_DATA *pp_data = NULL;
BOOLEAN res;
NTSTATUS nt_res;
if (hid_init() < 0) {
return NULL;
}
dev = new_hid_device();
// Open a handle to the device
dev->device_handle = open_device(path);
// Check validity of write_handle.
if (dev->device_handle == INVALID_HANDLE_VALUE) {
// Unable to open the device.
register_error(dev, "CreateFile");
goto err;
}
// Get the Input Report length for the device.
res = HidD_GetPreparsedData(dev->device_handle, &pp_data);
if (!res) {
register_error(dev, "HidD_GetPreparsedData");
goto err;
}
nt_res = HidP_GetCaps(pp_data, &caps);
if (nt_res != HIDP_STATUS_SUCCESS) {
register_error(dev, "HidP_GetCaps");
goto err_pp_data;
}
dev->input_report_length = caps.InputReportByteLength;
HidD_FreePreparsedData(pp_data);
dev->read_buf = (char*) malloc(dev->input_report_length);
return dev;
err_pp_data:
HidD_FreePreparsedData(pp_data);
err:
CloseHandle(dev->device_handle);
free(dev);
return NULL;
}
int HID_API_EXPORT HID_API_CALL hid_write(hid_device *dev, const unsigned char *data, size_t length)
{
DWORD bytes_written;
BOOLEAN res;
OVERLAPPED ol;
memset(&ol, 0, sizeof(ol));
res = WriteFile(dev->device_handle, data, length, NULL, &ol);
if (!res) {
if (GetLastError() != ERROR_IO_PENDING) {
// WriteFile() failed. Return error.
register_error(dev, "WriteFile");
return -1;
}
}
// Wait here until the write is done. This makes
// hid_write() synchronous.
res = GetOverlappedResult(dev->device_handle, &ol, &bytes_written, TRUE/*wait*/);
if (!res) {
// The Write operation failed.
register_error(dev, "WriteFile");
return -1;
}
return bytes_written;
}
int HID_API_EXPORT HID_API_CALL hid_set_ptt(int state)
{
int res;
hid_device *handle;
unsigned char buf[16];
handle = hid_open(0xd8c, 0x8, NULL);
if (!handle) {
printf("unable to open device\n");
return 1;
}
// Toggle PTT
buf[0] = 0;
buf[1] = 0;
buf[2]= 1 << (3 - 1);
buf[3] = state << (3 - 1);
buf[4] = 0;
res = hid_write(handle, buf, 5);
if (res < 0)
{
printf("Unable to write()\n");
printf("Error: %ls\n", hid_error(handle));
}
hid_close(handle);
return res;
}
int HID_API_EXPORT HID_API_CALL hid_read_timeout(hid_device *dev, unsigned char *data, size_t length, int milliseconds)
{
DWORD bytes_read = 0;
BOOLEAN res;
// Copy the handle for convenience.
HANDLE ev = dev->ol.hEvent;
if (!dev->read_pending) {
// Start an Overlapped I/O read.
dev->read_pending = TRUE;
ResetEvent(ev);
res = ReadFile(dev->device_handle, dev->read_buf, dev->input_report_length, &bytes_read, &dev->ol);
if (!res) {
if (GetLastError() != ERROR_IO_PENDING) {
// ReadFile() has failed.
// Clean up and return error.
CancelIo(dev->device_handle);
dev->read_pending = FALSE;
goto end_of_function;
}
}
}
if (milliseconds >= 0) {
// See if there is any data yet.
res = WaitForSingleObject(ev, milliseconds);
if (res != WAIT_OBJECT_0) {
// There was no data this time. Return zero bytes available,
// but leave the Overlapped I/O running.
return 0;
}
}
// Either WaitForSingleObject() told us that ReadFile has completed, or
// we are in non-blocking mode. Get the number of bytes read. The actual
// data has been copied to the data[] array which was passed to ReadFile().
res = GetOverlappedResult(dev->device_handle, &dev->ol, &bytes_read, TRUE/*wait*/);
// Set pending back to false, even if GetOverlappedResult() returned error.
dev->read_pending = FALSE;
if (res && bytes_read > 0) {
if (dev->read_buf[0] == 0x0) {
/* If report numbers aren't being used, but Windows sticks a report
number (0x0) on the beginning of the report anyway. To make this
work like the other platforms, and to make it work more like the
HID spec, we'll skip over this byte. */
bytes_read--;
memcpy(data, dev->read_buf+1, length);
}
else {
/* Copy the whole buffer, report number and all. */
memcpy(data, dev->read_buf, length);
}
}
end_of_function:
if (!res) {
register_error(dev, "GetOverlappedResult");
return -1;
}
return bytes_read;
}
int HID_API_EXPORT HID_API_CALL hid_read(hid_device *dev, unsigned char *data, size_t length)
{
return hid_read_timeout(dev, data, length, (dev->blocking)? -1: 0);
}
int HID_API_EXPORT HID_API_CALL hid_set_nonblocking(hid_device *dev, int nonblock)
{
dev->blocking = !nonblock;
return 0; /* Success */
}
int HID_API_EXPORT HID_API_CALL hid_send_feature_report(hid_device *dev, const unsigned char *data, size_t length)
{
BOOLEAN res = HidD_SetFeature(dev->device_handle, (PVOID)data, length);
if (!res) {
register_error(dev, "HidD_SetFeature");
return -1;
}
return length;
}
int HID_API_EXPORT HID_API_CALL hid_get_feature_report(hid_device *dev, unsigned char *data, size_t length)
{
BOOLEAN res;
#if 0
res = HidD_GetFeature(dev->device_handle, data, length);
if (!res) {
register_error(dev, "HidD_GetFeature");
return -1;
}
return 0; /* HidD_GetFeature() doesn't give us an actual length, unfortunately */
#else
DWORD bytes_returned;
OVERLAPPED ol;
memset(&ol, 0, sizeof(ol));
res = DeviceIoControl(dev->device_handle,
IOCTL_HID_GET_FEATURE,
data, length,
data, length,
&bytes_returned, &ol);
if (!res) {
if (GetLastError() != ERROR_IO_PENDING) {
// DeviceIoControl() failed. Return error.
register_error(dev, "Send Feature Report DeviceIoControl");
return -1;
}
}
// Wait here until the write is done. This makes
// hid_get_feature_report() synchronous.
res = GetOverlappedResult(dev->device_handle, &ol, &bytes_returned, TRUE/*wait*/);
if (!res) {
// The operation failed.
register_error(dev, "Send Feature Report GetOverLappedResult");
return -1;
}
return bytes_returned;
#endif
}
void HID_API_EXPORT HID_API_CALL hid_close(hid_device *dev)
{
if (!dev)
return;
CancelIo(dev->device_handle);
CloseHandle(dev->ol.hEvent);
CloseHandle(dev->device_handle);
LocalFree(dev->last_error_str);
free(dev->read_buf);
free(dev);
}
int HID_API_EXPORT_CALL HID_API_CALL hid_get_manufacturer_string(hid_device *dev, wchar_t *string, size_t maxlen)
{
BOOLEAN res;
res = HidD_GetManufacturerString(dev->device_handle, string, 2 * maxlen);
if (!res) {
register_error(dev, "HidD_GetManufacturerString");
return -1;
}
return 0;
}
int HID_API_EXPORT_CALL HID_API_CALL hid_get_product_string(hid_device *dev, wchar_t *string, size_t maxlen)
{
BOOLEAN res;
res = HidD_GetProductString(dev->device_handle, string, 2 * maxlen);
if (!res) {
register_error(dev, "HidD_GetProductString");
return -1;
}
return 0;
}
int HID_API_EXPORT_CALL HID_API_CALL hid_get_serial_number_string(hid_device *dev, wchar_t *string, size_t maxlen)
{
BOOLEAN res;
res = HidD_GetSerialNumberString(dev->device_handle, string, 2 * maxlen);
if (!res) {
register_error(dev, "HidD_GetSerialNumberString");
return -1;
}
return 0;
}
int HID_API_EXPORT_CALL HID_API_CALL hid_get_indexed_string(hid_device *dev, int string_index, wchar_t *string, size_t maxlen)
{
BOOLEAN res;
res = HidD_GetIndexedString(dev->device_handle, string_index, string, 2 * maxlen);
if (!res) {
register_error(dev, "HidD_GetIndexedString");
return -1;
}
return 0;
}
HID_API_EXPORT const wchar_t * HID_API_CALL hid_error(hid_device *dev)
{
return (wchar_t*)dev->last_error_str;
}
//#define PICPGM
//#define S11
#define P32
#ifdef S11
unsigned short VendorID = 0xa0a0;
unsigned short ProductID = 0x0001;
#endif
#ifdef P32
unsigned short VendorID = 0x04d8;
unsigned short ProductID = 0x3f;
#endif
#ifdef PICPGM
unsigned short VendorID = 0x04d8;
unsigned short ProductID = 0x0033;
#endif
#if 0
int __cdecl main(int argc, char* argv[])
{
int res;
unsigned char buf[65];
UNREFERENCED_PARAMETER(argc);
UNREFERENCED_PARAMETER(argv);
// Set up the command buffer.
memset(buf,0x00,sizeof(buf));
buf[0] = 0;
buf[1] = 0x81;
// Open the device.
int handle = open(VendorID, ProductID, L"12345");
if (handle < 0)
printf("unable to open device\n");
// Toggle LED (cmd 0x80)
buf[1] = 0x80;
res = write(handle, buf, 65);
if (res < 0)
printf("Unable to write()\n");
// Request state (cmd 0x81)
buf[1] = 0x81;
write(handle, buf, 65);
if (res < 0)
printf("Unable to write() (2)\n");
// Read requested state
read(handle, buf, 65);
if (res < 0)
printf("Unable to read()\n");
// Print out the returned buffer.
for (int i = 0; i < 4; i++)
printf("buf[%d]: %d\n", i, buf[i]);
return 0;
}
#endif
#ifdef __cplusplus
} // extern "C"
#endif

386
hidapi.h Normal file
View File

@ -0,0 +1,386 @@
/*******************************************************
HIDAPI - Multi-Platform library for
communication with HID devices.
Alan Ott
Signal 11 Software
8/22/2009
Copyright 2009, All Rights Reserved.
At the discretion of the user of this library,
this software may be licensed under the terms of the
GNU Public License v3, a BSD-Style license, or the
original HIDAPI license as outlined in the LICENSE.txt,
LICENSE-gpl3.txt, LICENSE-bsd.txt, and LICENSE-orig.txt
files located at the root of the source distribution.
These files may also be found in the public source
code repository located at:
http://github.com/signal11/hidapi .
********************************************************/
/** @file
* @defgroup API hidapi API
*/
#ifndef HIDAPI_H__
#define HIDAPI_H__
#include <wchar.h>
#ifdef _WIN32
// #define HID_API_EXPORT __declspec(dllexport) // BPQ
#define HID_API_EXPORT
#define HID_API_CALL
#else
#define HID_API_EXPORT /**< API export macro */
#define HID_API_CALL /**< API call macro */
#endif
#define HID_API_EXPORT_CALL HID_API_EXPORT HID_API_CALL /**< API export and call macro*/
#ifdef __cplusplus
extern "C" {
#endif
struct hid_device_;
typedef struct hid_device_ hid_device; /**< opaque hidapi structure */
/** hidapi info structure */
struct hid_device_info {
/** Platform-specific device path */
char *path;
/** Device Vendor ID */
unsigned short vendor_id;
/** Device Product ID */
unsigned short product_id;
/** Serial Number */
wchar_t *serial_number;
/** Device Release Number in binary-coded decimal,
also known as Device Version Number */
unsigned short release_number;
/** Manufacturer String */
wchar_t *manufacturer_string;
/** Product string */
wchar_t *product_string;
/** Usage Page for this Device/Interface
(Windows/Mac only). */
unsigned short usage_page;
/** Usage for this Device/Interface
(Windows/Mac only).*/
unsigned short usage;
/** The USB interface which this logical device
represents. Valid on both Linux implementations
in all cases, and valid on the Windows implementation
only if the device contains more than one interface. */
int interface_number;
/** Pointer to the next device */
struct hid_device_info *next;
};
/** @brief Initialize the HIDAPI library.
This function initializes the HIDAPI library. Calling it is not
strictly necessary, as it will be called automatically by
hid_enumerate() and any of the hid_open_*() functions if it is
needed. This function should be called at the beginning of
execution however, if there is a chance of HIDAPI handles
being opened by different threads simultaneously.
@ingroup API
@returns
This function returns 0 on success and -1 on error.
*/
int HID_API_EXPORT HID_API_CALL hid_init(void);
/** @brief Finalize the HIDAPI library.
This function frees all of the static data associated with
HIDAPI. It should be called at the end of execution to avoid
memory leaks.
@ingroup API
@returns
This function returns 0 on success and -1 on error.
*/
int HID_API_EXPORT HID_API_CALL hid_exit(void);
/** @brief Enumerate the HID Devices.
This function returns a linked list of all the HID devices
attached to the system which match vendor_id and product_id.
If @p vendor_id and @p product_id are both set to 0, then
all HID devices will be returned.
@ingroup API
@param vendor_id The Vendor ID (VID) of the types of device
to open.
@param product_id The Product ID (PID) of the types of
device to open.
@returns
This function returns a pointer to a linked list of type
struct #hid_device, containing information about the HID devices
attached to the system, or NULL in the case of failure. Free
this linked list by calling hid_free_enumeration().
*/
struct hid_device_info HID_API_EXPORT * HID_API_CALL hid_enumerate(unsigned short vendor_id, unsigned short product_id);
/** @brief Free an enumeration Linked List
This function frees a linked list created by hid_enumerate().
@ingroup API
@param devs Pointer to a list of struct_device returned from
hid_enumerate().
*/
void HID_API_EXPORT HID_API_CALL hid_free_enumeration(struct hid_device_info *devs);
/** @brief Open a HID device using a Vendor ID (VID), Product ID
(PID) and optionally a serial number.
If @p serial_number is NULL, the first device with the
specified VID and PID is opened.
@ingroup API
@param vendor_id The Vendor ID (VID) of the device to open.
@param product_id The Product ID (PID) of the device to open.
@param serial_number The Serial Number of the device to open
(Optionally NULL).
@returns
This function returns a pointer to a #hid_device object on
success or NULL on failure.
*/
HID_API_EXPORT hid_device * HID_API_CALL hid_open(unsigned short vendor_id, unsigned short product_id, wchar_t *serial_number);
/** @brief Open a HID device by its path name.
The path name be determined by calling hid_enumerate(), or a
platform-specific path name can be used (eg: /dev/hidraw0 on
Linux).
@ingroup API
@param path The path name of the device to open
@returns
This function returns a pointer to a #hid_device object on
success or NULL on failure.
*/
HID_API_EXPORT hid_device * HID_API_CALL hid_open_path(const char *path);
/** @brief Write an Output report to a HID device.
The first byte of @p data[] must contain the Report ID. For
devices which only support a single report, this must be set
to 0x0. The remaining bytes contain the report data. Since
the Report ID is mandatory, calls to hid_write() will always
contain one more byte than the report contains. For example,
if a hid report is 16 bytes long, 17 bytes must be passed to
hid_write(), the Report ID (or 0x0, for devices with a
single report), followed by the report data (16 bytes). In
this example, the length passed in would be 17.
hid_write() will send the data on the first OUT endpoint, if
one exists. If it does not, it will send the data through
the Control Endpoint (Endpoint 0).
@ingroup API
@param device A device handle returned from hid_open().
@param data The data to send, including the report number as
the first byte.
@param length The length in bytes of the data to send.
@returns
This function returns the actual number of bytes written and
-1 on error.
*/
int HID_API_EXPORT HID_API_CALL hid_write(hid_device *device, const unsigned char *data, size_t length);
/** @brief Read an Input report from a HID device with timeout.
Input reports are returned
to the host through the INTERRUPT IN endpoint. The first byte will
contain the Report number if the device uses numbered reports.
@ingroup API
@param device A device handle returned from hid_open().
@param data A buffer to put the read data into.
@param length The number of bytes to read. For devices with
multiple reports, make sure to read an extra byte for
the report number.
@param milliseconds timeout in milliseconds or -1 for blocking wait.
@returns
This function returns the actual number of bytes read and
-1 on error.
*/
int HID_API_EXPORT HID_API_CALL hid_read_timeout(hid_device *dev, unsigned char *data, size_t length, int milliseconds);
/** @brief Read an Input report from a HID device.
Input reports are returned
to the host through the INTERRUPT IN endpoint. The first byte will
contain the Report number if the device uses numbered reports.
@ingroup API
@param device A device handle returned from hid_open().
@param data A buffer to put the read data into.
@param length The number of bytes to read. For devices with
multiple reports, make sure to read an extra byte for
the report number.
@returns
This function returns the actual number of bytes read and
-1 on error.
*/
int HID_API_EXPORT HID_API_CALL hid_read(hid_device *device, unsigned char *data, size_t length);
/** @brief Set the device handle to be non-blocking.
In non-blocking mode calls to hid_read() will return
immediately with a value of 0 if there is no data to be
read. In blocking mode, hid_read() will wait (block) until
there is data to read before returning.
Nonblocking can be turned on and off at any time.
@ingroup API
@param device A device handle returned from hid_open().
@param nonblock enable or not the nonblocking reads
- 1 to enable nonblocking
- 0 to disable nonblocking.
@returns
This function returns 0 on success and -1 on error.
*/
int HID_API_EXPORT HID_API_CALL hid_set_nonblocking(hid_device *device, int nonblock);
/** @brief Send a Feature report to the device.
Feature reports are sent over the Control endpoint as a
Set_Report transfer. The first byte of @p data[] must
contain the Report ID. For devices which only support a
single report, this must be set to 0x0. The remaining bytes
contain the report data. Since the Report ID is mandatory,
calls to hid_send_feature_report() will always contain one
more byte than the report contains. For example, if a hid
report is 16 bytes long, 17 bytes must be passed to
hid_send_feature_report(): the Report ID (or 0x0, for
devices which do not use numbered reports), followed by the
report data (16 bytes). In this example, the length passed
in would be 17.
@ingroup API
@param device A device handle returned from hid_open().
@param data The data to send, including the report number as
the first byte.
@param length The length in bytes of the data to send, including
the report number.
@returns
This function returns the actual number of bytes written and
-1 on error.
*/
int HID_API_EXPORT HID_API_CALL hid_send_feature_report(hid_device *device, const unsigned char *data, size_t length);
/** @brief Get a feature report from a HID device.
Make sure to set the first byte of @p data[] to the Report
ID of the report to be read. Make sure to allow space for
this extra byte in @p data[].
@ingroup API
@param device A device handle returned from hid_open().
@param data A buffer to put the read data into, including
the Report ID. Set the first byte of @p data[] to the
Report ID of the report to be read.
@param length The number of bytes to read, including an
extra byte for the report ID. The buffer can be longer
than the actual report.
@returns
This function returns the number of bytes read and
-1 on error.
*/
int HID_API_EXPORT HID_API_CALL hid_get_feature_report(hid_device *device, unsigned char *data, size_t length);
/** @brief Close a HID device.
@ingroup API
@param device A device handle returned from hid_open().
*/
void HID_API_EXPORT HID_API_CALL hid_close(hid_device *device);
/** @brief Get The Manufacturer String from a HID device.
@ingroup API
@param device A device handle returned from hid_open().
@param string A wide string buffer to put the data into.
@param maxlen The length of the buffer in multiples of wchar_t.
@returns
This function returns 0 on success and -1 on error.
*/
int HID_API_EXPORT_CALL hid_get_manufacturer_string(hid_device *device, wchar_t *string, size_t maxlen);
/** @brief Get The Product String from a HID device.
@ingroup API
@param device A device handle returned from hid_open().
@param string A wide string buffer to put the data into.
@param maxlen The length of the buffer in multiples of wchar_t.
@returns
This function returns 0 on success and -1 on error.
*/
int HID_API_EXPORT_CALL hid_get_product_string(hid_device *device, wchar_t *string, size_t maxlen);
/** @brief Get The Serial Number String from a HID device.
@ingroup API
@param device A device handle returned from hid_open().
@param string A wide string buffer to put the data into.
@param maxlen The length of the buffer in multiples of wchar_t.
@returns
This function returns 0 on success and -1 on error.
*/
int HID_API_EXPORT_CALL hid_get_serial_number_string(hid_device *device, wchar_t *string, size_t maxlen);
/** @brief Get a string from a HID device, based on its string index.
@ingroup API
@param device A device handle returned from hid_open().
@param string_index The index of the string to get.
@param string A wide string buffer to put the data into.
@param maxlen The length of the buffer in multiples of wchar_t.
@returns
This function returns 0 on success and -1 on error.
*/
int HID_API_EXPORT_CALL hid_get_indexed_string(hid_device *device, int string_index, wchar_t *string, size_t maxlen);
/** @brief Get a string describing the last error which occurred.
@ingroup API
@param device A device handle returned from hid_open().
@returns
This function returns a string containing the last error
which occurred or NULL if none has occurred.
*/
HID_API_EXPORT const wchar_t* HID_API_CALL hid_error(hid_device *device);
int HID_API_EXPORT HID_API_CALL hid_set_ptt(int state);
#ifdef __cplusplus
}
#endif
#endif

BIN
icon1.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

BIN
icon2.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

26
main.cpp Normal file
View File

@ -0,0 +1,26 @@
#include "QtTermTCP.h"
#include <QApplication>
#include <qscreen.h>
QApplication * a;
int screenHeight = 0; // used to control dialog sizes on Android
int screenWidth = 0;
int main(int argc, char *argv[])
{
a = new QApplication (argc, argv);
QSize r = a->screens()[0]->size();
screenHeight = r.height();
screenWidth = r.width();
QtTermTCP w;
//#ifdef ANDROID
// w.setWindowFlags(Qt::Window | Qt::CustomizeWindowHint); // Qt::FramelessWindowHint);
//#endif
w.show();
return a->exec();
}

9
makeit Normal file
View File

@ -0,0 +1,9 @@
cp --preserve /mnt/Source/QT/QtTermTCP/*.cpp ./
cp --preserve /mnt/Source/QT/QtTermTCP/*.c ./
cp --preserve /mnt/Source/QT/QtTermTCP/*.h ./
cp --preserve /mnt/Source/QT/QtTermTCP/*.ui ./
qmake
make -j4
cp QtTermTCP /mnt/Source

65
ui_TCPHostConfig.h Normal file
View File

@ -0,0 +1,65 @@
/********************************************************************************
** Form generated from reading UI file 'TCPHostConfig.ui'
**
** Created by: Qt User Interface Compiler version 5.14.2
**
** WARNING! All changes made in this file will be lost when recompiling UI file!
********************************************************************************/
#ifndef UI_TCPHOSTCONFIG_H
#define UI_TCPHOSTCONFIG_H
#include <QtCore/QVariant>
#include <QtGui/QIcon>
#include <QtWidgets/QApplication>
#include <QtWidgets/QDialog>
#include <QtWidgets/QDialogButtonBox>
#include <QtWidgets/QTextEdit>
QT_BEGIN_NAMESPACE
class Ui_Dialog
{
public:
QDialogButtonBox *buttonBox;
QTextEdit *Host;
void setupUi(QDialog *Dialog)
{
if (Dialog->objectName().isEmpty())
Dialog->setObjectName(QString::fromUtf8("Dialog"));
Dialog->resize(400, 300);
QIcon icon;
icon.addFile(QString::fromUtf8("QtTermTCP.ico"), QSize(), QIcon::Normal, QIcon::Off);
Dialog->setWindowIcon(icon);
buttonBox = new QDialogButtonBox(Dialog);
buttonBox->setObjectName(QString::fromUtf8("buttonBox"));
buttonBox->setGeometry(QRect(30, 240, 341, 32));
buttonBox->setOrientation(Qt::Horizontal);
buttonBox->setStandardButtons(QDialogButtonBox::Cancel|QDialogButtonBox::Save);
buttonBox->setCenterButtons(true);
Host = new QTextEdit(Dialog);
Host->setObjectName(QString::fromUtf8("Host"));
Host->setGeometry(QRect(184, 44, 104, 23));
retranslateUi(Dialog);
QObject::connect(buttonBox, SIGNAL(accepted()), Dialog, SLOT(accept()));
QObject::connect(buttonBox, SIGNAL(rejected()), Dialog, SLOT(reject()));
QMetaObject::connectSlotsByName(Dialog);
} // setupUi
void retranslateUi(QDialog *Dialog)
{
Dialog->setWindowTitle(QCoreApplication::translate("Dialog", "TCP Host Config", nullptr));
} // retranslateUi
};
namespace Ui {
class Dialog: public Ui_Dialog {};
} // namespace Ui
QT_END_NAMESPACE
#endif // UI_TCPHOSTCONFIG_H

597
utf8Routines.cpp Normal file
View File

@ -0,0 +1,597 @@
/*
Copyright 2001-2018 John Wiseman G8BPQ
This file is part of LinBPQ/BPQ32.
LinBPQ/BPQ32 is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
LinBPQ/BPQ32 is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with LinBPQ/BPQ32. If not, see http://www.gnu.org/licenses
*/
// Routines to convert to and from UTF8
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#define _CRT_SECURE_NO_DEPRECATE
#ifndef WIN32
#define VOID void
#define BOOL int
#define TRUE 1
#define FALSE 0
#include <string.h>
#else
#include <windows.h>
#endif
int convUTF8 = 0;
unsigned int CP437toUTF8Data[128] = {
34755, 48323, 43459, 41667,
42179, 41155, 42435, 42947,
43715, 43971, 43203, 44995,
44739, 44227, 33987, 34243,
35267, 42691, 34499, 46275, // 90
46787, 45763, 48067, 47555,
49091, 38595, 40131, 41666,
41922, 42434, 10978018, 37574,
41411, 44483, 46019, 47811, // A0
45507, 37315, 43714, 47810,
49090, 9473250, 44226, 48578,
48322, 41410, 43970, 48066,
9541346, 9606882, 9672418, 8557794, //B0
10786018, 10589666, 10655202, 9868770,
9803234, 10720738, 9541090, 9934306,
10327522, 10261986, 10196450, 9475298,
9737442, 11834594, 11310306, 10261730, //C0
8426722, 12358882, 10393058, 10458594,
10130914, 9737698, 11113954, 10917346,
10524130, 9475554, 11310562, 10982882,
11048418, 10786274, 10851810, 10065378, //D0
9999842, 9606626, 9672162, 11245026,
11179490, 9999586, 9213154, 8951522,
8689378, 9213666, 9475810, 8427234,
45518, 40899, 37838, 32975, // E0
41934, 33743, 46530, 33999,
42702, 39118, 43470, 46286,
10389730, 34511, 46542, 11110626,
10586594, 45506, 10848738, 10783202, // F0
10521826, 10587362, 47043, 8948194,
45250, 10062050, 47042, 10127586,
12550626, 45762, 10524386, 41154,
};
unsigned int CP437toUTF8DataLen[128] = {
2, 2, 2, 2,
2, 2, 2, 2,
2, 2, 2, 2,
2, 2, 2, 2,
2, 2, 2, 2,
2, 2, 2, 2,
2, 2, 2, 2,
2, 2, 3, 2,
2, 2, 2, 2,
2, 2, 2, 2,
2, 3, 2, 2,
2, 2, 2, 2,
3, 3, 3, 3,
3, 3, 3, 3,
3, 3, 3, 3,
3, 3, 3, 3,
3, 3, 3, 3,
3, 3, 3, 3,
3, 3, 3, 3,
3, 3, 3, 3,
3, 3, 3, 3,
3, 3, 3, 3,
3, 3, 3, 3,
3, 3, 3, 3,
2, 2, 2, 2,
2, 2, 2, 2,
2, 2, 2, 2,
3, 2, 2, 3,
3, 2, 3, 3,
3, 3, 2, 3,
2, 3, 2, 3,
3, 2, 3, 2,
};
unsigned int CP1251toUTF8Data[128] = {
33488, 33744, 10125538, 37841,
10387682, 10911970, 10518754, 10584290,
11305698, 11567330, 35280, 12157154,
35536, 36048, 35792, 36816,
37585, 9994466, 10060002, 10256610,
10322146, 10649826, 9666786, 9732322,
39106, 10650850, 39377, 12222690,
39633, 40145, 39889, 40913,
41154, 36560, 40657, 35024,
42178, 37074, 42690, 42946,
33232, 43458, 34000, 43970,
44226, 44482, 44738, 34768,
45250, 45506, 34512, 38609,
37330, 46530, 46786, 47042,
37329, 9864418, 38097, 48066,
39121, 34256, 38353, 38865,
37072, 37328, 37584, 37840,
38096, 38352, 38608, 38864,
39120, 39376, 39632, 39888,
40144, 40400, 40656, 40912,
41168, 41424, 41680, 41936,
42192, 42448, 42704, 42960,
43216, 43472, 43728, 43984,
44240, 44496, 44752, 45008,
45264, 45520, 45776, 46032,
46288, 46544, 46800, 47056,
47312, 47568, 47824, 48080,
48336, 48592, 48848, 49104,
32977, 33233, 33489, 33745,
34001, 34257, 34513, 34769,
35025, 35281, 35537, 35793,
36049, 36305, 36561, 36817,
};
unsigned int CP1251toUTF8DataLen[128] = {
2, 2, 3, 2,
3, 3, 3, 3,
3, 3, 2, 3,
2, 2, 2, 2,
2, 3, 3, 3,
3, 3, 3, 3,
2, 3, 2, 3,
2, 2, 2, 2,
2, 2, 2, 2,
2, 2, 2, 2,
2, 2, 2, 2,
2, 2, 2, 2,
2, 2, 2, 2,
2, 2, 2, 2,
2, 3, 2, 2,
2, 2, 2, 2,
2, 2, 2, 2,
2, 2, 2, 2,
2, 2, 2, 2,
2, 2, 2, 2,
2, 2, 2, 2,
2, 2, 2, 2,
2, 2, 2, 2,
2, 2, 2, 2,
2, 2, 2, 2,
2, 2, 2, 2,
2, 2, 2, 2,
2, 2, 2, 2,
2, 2, 2, 2,
2, 2, 2, 2,
2, 2, 2, 2,
2, 2, 2, 2,
};
unsigned int CP1252toUTF8Data[128] = {
11305698, 33218, 10125538, 37574,
10387682, 10911970, 10518754, 10584290,
34507, 11567330, 41157, 12157154,
37573, 36290, 48581, 36802,
37058, 9994466, 10060002, 10256610,
10322146, 10649826, 9666786, 9732322,
40139, 10650850, 41413, 12222690,
37829, 40386, 48837, 47301,
41154, 41410, 41666, 41922,
42178, 42434, 42690, 42946,
43202, 43458, 43714, 43970,
44226, 44482, 44738, 44994,
45250, 45506, 45762, 46018,
46274, 46530, 46786, 47042,
47298, 47554, 47810, 48066,
48322, 48578, 48834, 49090,
32963, 33219, 33475, 33731,
33987, 34243, 34499, 34755,
35011, 35267, 35523, 35779,
36035, 36291, 36547, 36803,
37059, 37315, 37571, 37827,
38083, 38339, 38595, 38851,
39107, 39363, 39619, 39875,
40131, 40387, 40643, 40899,
41155, 41411, 41667, 41923,
42179, 42435, 42691, 42947,
43203, 43459, 43715, 43971,
44227, 44483, 44739, 44995,
45251, 45507, 45763, 46019,
46275, 46531, 46787, 47043,
47299, 47555, 47811, 48067,
48323, 48579, 48835, 49091,
};
unsigned int CP1252toUTF8DataLen[128] = {
3, 2, 3, 2,
3, 3, 3, 3,
2, 3, 2, 3,
2, 2, 2, 2,
2, 3, 3, 3,
3, 3, 3, 3,
2, 3, 2, 3,
2, 2, 2, 2,
2, 2, 2, 2,
2, 2, 2, 2,
2, 2, 2, 2,
2, 2, 2, 2,
2, 2, 2, 2,
2, 2, 2, 2,
2, 2, 2, 2,
2, 2, 2, 2,
2, 2, 2, 2,
2, 2, 2, 2,
2, 2, 2, 2,
2, 2, 2, 2,
2, 2, 2, 2,
2, 2, 2, 2,
2, 2, 2, 2,
2, 2, 2, 2,
2, 2, 2, 2,
2, 2, 2, 2,
2, 2, 2, 2,
2, 2, 2, 2,
2, 2, 2, 2,
2, 2, 2, 2,
2, 2, 2, 2,
2, 2, 2, 2,
};
#ifdef __BIG_ENDIAN__
BOOL initUTF8Done = FALSE;
#else
BOOL initUTF8Done = TRUE;
#endif
VOID initUTF8()
{
// Swap bytes of UTF-8 COde on Big-endian systems
int n;
char temp[4];
char rev[4];
if (initUTF8Done)
return;
for (n = 0; n <128; n++)
{
memcpy(temp, &CP437toUTF8Data[n], 4);
rev[0] = temp[3];
rev[1] = temp[2];
rev[2] = temp[1];
rev[3] = temp[0];
memcpy(&CP437toUTF8Data[n], rev, 4);
memcpy(temp, &CP1251toUTF8Data[n], 4);
rev[0] = temp[3];
rev[1] = temp[2];
rev[2] = temp[1];
rev[3] = temp[0];
memcpy(&CP1251toUTF8Data[n], rev, 4);
memcpy(temp, &CP1252toUTF8Data[n], 4);
rev[0] = temp[3];
rev[1] = temp[2];
rev[2] = temp[1];
rev[3] = temp[0];
memcpy(&CP1252toUTF8Data[n], rev, 4);
}
initUTF8Done = TRUE;
}
int Is8Bit(unsigned char *cpt, int len)
{
int n;
cpt--;
for (n = 0; n < len; n++)
{
cpt++;
if (*cpt > 127)
return TRUE;
}
return FALSE;
}
int IsUTF8(unsigned char *ptr, int len)
{
int n;
unsigned char * cpt = ptr;
// This has to be a bit loose, as UTF8 sequences may split over packets
memcpy(&ptr[len], "\x80\x80\x80", 3); // in case trailing bytes are in next packet
// Don't check first 3 if could be part of sequence
if ((*(cpt) & 0xC0) == 0x80) // Valid continuation
{
cpt++;
len--;
if ((*(cpt) & 0xC0) == 0x80) // Valid continuation
{
cpt++;
len--;
if ((*(cpt) & 0xC0) == 0x80) // Valid continuation
{
cpt++;
len--;
}
}
}
cpt--;
for (n = 0; n < len; n++)
{
cpt++;
if (*cpt < 128)
continue;
if ((*cpt & 0xF8) == 0xF0)
{ // start of 4-byte sequence
if (((*(cpt + 1) & 0xC0) == 0x80)
&& ((*(cpt + 2) & 0xC0) == 0x80)
&& ((*(cpt + 3) & 0xC0) == 0x80))
{
cpt += 3;
n += 3;
continue;
}
return FALSE;
}
else if ((*cpt & 0xF0) == 0xE0)
{ // start of 3-byte sequence
if (((*(cpt + 1) & 0xC0) == 0x80)
&& ((*(cpt + 2) & 0xC0) == 0x80))
{
cpt += 2;
n += 2;
continue;
}
return FALSE;
}
else if ((*cpt & 0xE0) == 0xC0)
{ // start of 2-byte sequence
if ((*(cpt + 1) & 0xC0) == 0x80)
{
cpt++;
n++;
continue;
}
return FALSE;
}
return FALSE;
}
return TRUE;
}
int WebIsUTF8(unsigned char *ptr, int len)
{
int n;
unsigned char * cpt = ptr;
// This is simpler than the Term version, as it only handles complete lines of text, so cant get split sequences
cpt--;
for (n = 0; n < len; n++)
{
cpt++;
if (*cpt < 128)
continue;
if ((*cpt & 0xF8) == 0xF0)
{ // start of 4-byte sequence
if (((*(cpt + 1) & 0xC0) == 0x80)
&& ((*(cpt + 2) & 0xC0) == 0x80)
&& ((*(cpt + 3) & 0xC0) == 0x80))
{
cpt += 3;
n += 3;
continue;
}
return FALSE;
}
else if ((*cpt & 0xF0) == 0xE0)
{ // start of 3-byte sequence
if (((*(cpt + 1) & 0xC0) == 0x80)
&& ((*(cpt + 2) & 0xC0) == 0x80))
{
cpt += 2;
n += 2;
continue;
}
return FALSE;
}
else if ((*cpt & 0xE0) == 0xC0)
{ // start of 2-byte sequence
if ((*(cpt + 1) & 0xC0) == 0x80)
{
cpt++;
n++;
continue;
}
return FALSE;
}
return FALSE;
}
return TRUE;
}
int Convert437toUTF8(unsigned char * MsgPtr, int len, unsigned char * UTF)
{
unsigned char * ptr1 = MsgPtr;
unsigned char * ptr2 = UTF;
int n;
unsigned int c;
for (n = 0; n < len; n++)
{
c = *(ptr1++);
if (c < 128)
{
*(ptr2++) = c;
continue;
}
memcpy(ptr2, &CP437toUTF8Data[c - 128], CP437toUTF8DataLen[c - 128]);
ptr2 += CP437toUTF8DataLen[c - 128];
}
return (int)(ptr2 - UTF);
}
int Convert1251toUTF8(unsigned char * MsgPtr, int len, unsigned char * UTF)
{
unsigned char * ptr1 = MsgPtr;
unsigned char * ptr2 = UTF;
int n;
unsigned int c;
for (n = 0; n < len; n++)
{
c = *(ptr1++);
if (c < 128)
{
*(ptr2++) = c;
continue;
}
memcpy(ptr2, &CP1251toUTF8Data[c - 128], CP1251toUTF8DataLen[c - 128]);
ptr2 += CP1251toUTF8DataLen[c - 128];
}
return (int)(ptr2 - UTF);
}
int Convert1252toUTF8(unsigned char * MsgPtr, int len, unsigned char * UTF)
{
unsigned char * ptr1 = MsgPtr;
unsigned char * ptr2 = UTF;
int n;
unsigned int c;
for (n = 0; n < len; n++)
{
c = *(ptr1++);
if (c < 128)
{
*(ptr2++) = c;
continue;
}
memcpy(ptr2, &CP1252toUTF8Data[c - 128], CP1252toUTF8DataLen[c - 128]);
ptr2 += CP1252toUTF8DataLen[c - 128];
}
return (int)(ptr2 - UTF);
}
int TrytoGuessCode(unsigned char * Char, int Len)
{
int Above127 = 0;
int LineDraw = 0;
int NumericAndSpaces = 0;
int n;
for (n = 0; n < Len; n++)
{
if (Char[n] < 65)
{
NumericAndSpaces++;
}
else
{
if (Char[n] > 127)
{
Above127++;
if (Char[n] == 0xF8 || (Char[n] > 178 && Char[n] < 224))
{
LineDraw++;
}
}
}
}
if (Above127 == 0) // Doesn't really matter!
return 1252;
if (Above127 == LineDraw)
return 437; // If only Line Draw chars, assume line draw
// If mainly below 128, it is probably Latin if mainly above, probably Cyrillic
if ((Len - (NumericAndSpaces + Above127)) < Above127)
return 1251;
else
return 1252;
}
unsigned char outbuffer[16384]; // I don't think this needs to be thread safe
int checkUTF8(unsigned char * in, int len, unsigned char * out)
{
// We mustn't mess with input string
unsigned char Msg[8192];
int u, code = convUTF8;
if (convUTF8 == -1 || !Is8Bit(in, len))
{
// just copy to output
memcpy(out, in, len);
return len;
}
// Convert
memcpy(Msg, in, len);
Msg[len] = 0;
if (convUTF8 == 0) // Auto - Try to guess encoding
code = TrytoGuessCode(Msg, len);
if (code == 437)
u = Convert437toUTF8(Msg, len, out);
else if (code == 1251)
u = Convert1251toUTF8(Msg, len, out);
else
u = Convert1252toUTF8(Msg, len, out);
return u;
}