Skip to content

Commit

Permalink
Squashed commit of the following:
Browse files Browse the repository at this point in the history
commit 2a8911f
Author: Leor Bleier <Leor.Z.Bleier@nasa.gov>
Date:   Fri Jun 26 17:34:54 2020 -0400

    Enhancement nasa#103 - updates to allow user to select header version

    Updates GUI and backend to allow user to select
    header version offsets, or custom byte offsets

commit 9d233eb
Author: Leor Bleier <Leor.Z.Bleier@nasa.gov>
Date:   Thu Jun 25 17:12:31 2020 -0400

    WIP: Enhancement nasa#103 - updates to miniCmdUtil and other files

commit 6d3f7ed
Author: Leor Bleier <Leor.Z.Bleier@nasa.gov>
Date:   Wed Jun 24 13:53:51 2020 -0400

    WIP: Enhancement nasa#103 - updates to miniCmdUtil

commit 8ad565c
Author: Leor Bleier <Leor.Z.Bleier@nasa.gov>
Date:   Wed Jun 24 10:56:45 2020 -0400

    WIP: Enhancement nasa#103 - updates to miniCmdUtil

commit a0d1872
Author: Leor Bleier <Leor.Z.Bleier@nasa.gov>
Date:   Tue Jun 23 15:39:25 2020 -0400

    WIP: Enhancement nasa#103 - Implemented native cmdUtil

    Native cmdUtil has only subset of full cmdUtil functionality
    Also implemented updates to GUI and backend to support custom
    byte offsets in tlm and cmd

commit 09261e5
Author: Leor Bleier <Leor.Z.Bleier@nasa.gov>
Date:   Tue Jun 16 13:27:26 2020 -0400

    Enhancement nasa#103 - custom header mechanism

    Fix for rebase merge error

commit 7754c9f
Author: Leor Bleier <Leor.Z.Bleier@nasa.gov>
Date:   Tue Jun 16 12:38:33 2020 -0400

    Enhancement nasa#103 - custom header mechanism

    Updated UI and backend to support custom header sizes.
    Change only impacts tlm currently

commit 821f06c
Author: Leor Bleier <Leor.Z.Bleier@nasa.gov>
Date:   Mon Jun 1 09:57:02 2020 -0400

    Feature nasa#98 - Refactor UI to table widgets

    Removed unnecessary file

commit b0bd3fa
Author: Leor Bleier <Leor.Z.Bleier@nasa.gov>
Date:   Mon Jun 1 09:06:45 2020 -0400

    Feature nasa#98 - Refactor UI to use table widgets

    Backend updated accordingly. Other various tweaks/fixes as needed

commit fb0ccb6
Author: Leor Bleier <Leor.Z.Bleier@nasa.gov>
Date:   Wed May 27 16:23:40 2020 -0400

    Fix nasa#46 Recommended lgtm python issues

    Problems shown in this issue were fixed in nasa#72 as part of
    updates/refactoring. Other lgtm issues addressed here.
    Problems in auto-generated .py files not addressed.
    Auto-generated .py files renamed with Ui_ prefix.
    The lgtm.yml file must be updated to exclude these
    See nasa/cFS#92

commit b3d8039
Author: Leor Bleier <Leor.Z.Bleier@nasa.gov>
Date:   Wed May 20 07:54:39 2020 -0400

    Fix nasa#88 - Modify GroundSystem to use JSON files generated by CCDD

    Also includes further updates and refinements to overall UI

commit 26486cb
Author: Leor Bleier <Leor.Z.Bleier@nasa.gov>
Date:   Thu May 14 11:37:11 2020 -0400

    Fix nasa#72 - Upgrade PyQt4 to PyQt5

    Further edits based on CCB feedback, and other fixes as necessary

commit 876a39d
Author: Leor Bleier <Leor.Z.Bleier@nasa.gov>
Date:   Mon May 11 17:08:21 2020 -0400

    Fix nasa#72 - Upgrade PyQt4 to PyQt5

    Includes code cleanup/refactoring. Also fixes nasa#71
  • Loading branch information
lbleier-GSFC committed Jun 29, 2020
1 parent 52f706b commit adf31d8
Show file tree
Hide file tree
Showing 30 changed files with 1,432 additions and 12,576 deletions.
58 changes: 47 additions & 11 deletions GroundSystem.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
#cFS Ground System Version 2.0.0
# cFS Ground System Version 2.0.0
#
#!/usr/bin/env python3
#
Expand All @@ -28,8 +28,8 @@

from PyQt5.QtWidgets import QApplication, QMainWindow, QMessageBox

from MainWindow import Ui_MainWindow
from RoutingService import RoutingService
from Ui_MainWindow import Ui_MainWindow

ROOTDIR = Path(sys.argv[0]).resolve().parent

Expand All @@ -38,18 +38,25 @@
# CFS Ground System: Setup and manage the main window
#
class GroundSystem(QMainWindow, Ui_MainWindow):
HDR_VER_1_OFFSET = 0
HDR_VER_2_OFFSET = 4

#
# Init the class
#
def __init__(self):
super().__init__()
self.setupUi((self))
self.setupUi(self)

self.RoutingService = None
self.alert = QMessageBox()

self.pushButtonStartTlm.clicked.connect(self.startTlmSystem)
self.pushButtonStartCmd.clicked.connect(self.startCmdSystem)
self.cbTlmHeaderVer.currentIndexChanged.connect(self.setTlmOffset)
self.cbCmdHeaderVer.currentIndexChanged.connect(self.setCmdOffsets)
for sb in (self.sbTlmOffset, self.sbCmdOffsetPri, self.sbCmdOffsetSec):
sb.valueChanged.connect(self.saveOffsets)
# Init lists
self.ipAddressesList = ['All']
self.spacecraftNames = ['All']
Expand Down Expand Up @@ -81,14 +88,12 @@ def DisplayErrorMessage(self, message):

# Start the telemetry system for the selected spacecraft
def startTlmSystem(self):
# Setup the subscription (to let the telemetry
# system know the messages it will be receiving)
subscription = '--sub=GroundSystem'
selectedSpacecraft = self.getSelectedSpacecraftName()

# Setup the subscription (to let know the
# telemetry system the messages it will be receiving)
if selectedSpacecraft == 'All':
subscription = '--sub=GroundSystem'
else:
subscription = f'--sub=GroundSystem.{selectedSpacecraft}.TelemetryPackets'
if selectedSpacecraft != 'All':
subscription += f'.{selectedSpacecraft}.TelemetryPackets'

# Open Telemetry System
system_call = f'python3 {ROOTDIR}/Subsystems/tlmGUI/TelemetrySystem.py {subscription}'
Expand All @@ -105,7 +110,6 @@ def startCmdSystem():
def startFDLSystem(self):
selectedSpacecraft = self.getSelectedSpacecraftName()
if selectedSpacecraft == 'All':
subscription = ''
self.DisplayErrorMessage(
'Cannot open FDL manager.\nNo spacecraft selected.')
else:
Expand All @@ -115,6 +119,37 @@ def startFDLSystem(self):
subscription
])

def setTlmOffset(self):
selectedVer = self.cbTlmHeaderVer.currentText().strip()
if selectedVer == "Custom":
self.sbTlmOffset.setEnabled(True)
else:
self.sbTlmOffset.setEnabled(False)
if selectedVer == "1":
self.sbTlmOffset.setValue(self.HDR_VER_1_OFFSET)
elif selectedVer == "2":
self.sbTlmOffset.setValue(self.HDR_VER_2_OFFSET)

def setCmdOffsets(self):
selectedVer = self.cbCmdHeaderVer.currentText().strip()
if selectedVer == "Custom":
self.sbCmdOffsetPri.setEnabled(True)
self.sbCmdOffsetSec.setEnabled(True)
else:
self.sbCmdOffsetPri.setEnabled(False)
self.sbCmdOffsetSec.setEnabled(False)
if selectedVer == "1":
self.sbCmdOffsetPri.setValue(self.HDR_VER_1_OFFSET)
elif selectedVer == "2":
self.sbCmdOffsetPri.setValue(self.HDR_VER_2_OFFSET)
self.sbCmdOffsetSec.setValue(self.HDR_VER_1_OFFSET)

def saveOffsets(self):
offsets = bytes((self.sbTlmOffset.value(), self.sbCmdOffsetPri.value(),
self.sbCmdOffsetSec.value()))
with open("/tmp/OffsetData", "wb") as f:
f.write(offsets)

# Update the combo box list in gui
def updateIpList(self, ip, name):
self.ipAddressesList.append(ip)
Expand Down Expand Up @@ -145,6 +180,7 @@ def initRoutingService(self):

# Start the Routing Service
MainWindow.initRoutingService()
MainWindow.saveOffsets()

# Execute the app
sys.exit(app.exec_())
164 changes: 135 additions & 29 deletions MainWindow.ui
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>420</width>
<height>217</height>
<width>552</width>
<height>305</height>
</rect>
</property>
<property name="sizePolicy">
Expand All @@ -25,7 +25,7 @@
<widget class="QWidget" name="centralwidget">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLabel" name="labelHomeTittle">
<widget class="QLabel" name="labelHomeTitle">
<property name="font">
<font>
<pointsize>22</pointsize>
Expand All @@ -49,21 +49,8 @@
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QLabel" name="label_3">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
Expand All @@ -78,14 +65,14 @@
</size>
</property>
<property name="text">
<string>Selected IP Address: </string>
<string>Selected IP Address</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
<item row="0" column="1">
<widget class="QComboBox" name="comboBoxIpAddresses">
<property name="minimumSize">
<size>
Expand All @@ -106,18 +93,137 @@
</item>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
<item row="1" column="0">
<widget class="QLabel" name="label_4">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>169</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>Tlm header version</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
<property name="sizeHint" stdset="0">
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="cbTlmHeaderVer">
<property name="minimumSize">
<size>
<width>40</width>
<height>20</height>
<width>132</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>132</width>
<height>16777215</height>
</size>
</property>
</spacer>
<item>
<property name="text">
<string>1</string>
</property>
</item>
<item>
<property name="text">
<string>2</string>
</property>
</item>
<item>
<property name="text">
<string>Custom</string>
</property>
</item>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Cmd header version</string>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QSpinBox" name="sbTlmOffset">
<property name="enabled">
<bool>false</bool>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Offset (in bytes) to be &lt;span style=&quot; font-weight:600;&quot;&gt;added to&lt;/span&gt; existing offsets listed in telemetry text files&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="buttonSymbols">
<enum>QAbstractSpinBox::NoButtons</enum>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="QSpinBox" name="sbCmdOffsetPri">
<property name="enabled">
<bool>false</bool>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Offset (in bytes) to be added &lt;span style=&quot; font-weight:600;&quot;&gt;after&lt;/span&gt; the &lt;span style=&quot; font-weight:600;&quot;&gt;primary&lt;/span&gt; header in a command packet&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="buttonSymbols">
<enum>QAbstractSpinBox::NoButtons</enum>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QComboBox" name="cbCmdHeaderVer">
<item>
<property name="text">
<string>1</string>
</property>
</item>
<item>
<property name="text">
<string>2</string>
</property>
</item>
<item>
<property name="text">
<string>Custom</string>
</property>
</item>
</widget>
</item>
<item row="2" column="3">
<widget class="QSpinBox" name="sbCmdOffsetSec">
<property name="enabled">
<bool>false</bool>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Offset (in bytes) to be added &lt;span style=&quot; font-weight:600;&quot;&gt;after&lt;/span&gt; the &lt;span style=&quot; font-weight:600;&quot;&gt;secondary&lt;/span&gt; header in a command packet&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="buttonSymbols">
<enum>QAbstractSpinBox::NoButtons</enum>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QLabel" name="label">
<property name="text">
<string>Offsets</string>
</property>
</widget>
</item>
<item row="0" column="3">
<widget class="QLabel" name="label_6">
<property name="text">
<string>(Hover for info)</string>
</property>
</widget>
</item>
</layout>
</item>
Expand Down
3 changes: 1 addition & 2 deletions RoutingService.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,7 @@ def run(self):

# Handle errors
except socket.error:
print(
f'Ignored socket error for attempt {socketErrorCount}')
print('Ignored socket error for attempt', socketErrorCount)
socketErrorCount += 1
sleep(1)

Expand Down
10 changes: 4 additions & 6 deletions Subsystems/cmdGui/CHeaderParser.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,13 +103,11 @@ def getFileList(filename='CHeaderParser-hdr-paths.txt'):
l = l.strip()
if l and not l.startswith("#"):
paths.append(l)
print(f"Using header files found in {filename}")
# Send paths back to caller function
return paths
print(f"Using header files found in {filename}")
# Send paths back to caller function
return paths
except IOError:
print("Couldn't find default file. Check command line arguments.")
except:
print("Unexpected error:", sys.exc_info()[0])

print("No header files found. Please make sure to provide the\n"
"default file for loading headers (CHeaderParser-hdr-paths.txt)")
Expand Down Expand Up @@ -449,7 +447,7 @@ def getFileList(filename='CHeaderParser-hdr-paths.txt'):
input((f"Please enter the defined value for "
f"{array_name_size[1]} (0 - 128): ")))
except ValueError:
pass
pass # Ignore non-integer and try again

# Add string length argument to parameter list
stringLens.append(array_size)
Expand Down
Loading

0 comments on commit adf31d8

Please sign in to comment.