@@ -47,15 +47,19 @@ def __init__(self):
47
47
#
48
48
def displayTelemetryItem (self , datagram , tlmIndex , labelField , valueField ):
49
49
if tlmItemIsValid [tlmIndex ] == True :
50
- TlmField = unpack (tlmItemFormat [tlmIndex ], datagram [int (tlmItemStart [tlmIndex ]):(int (tlmItemStart [tlmIndex ]) + int (tlmItemSize [tlmIndex ]))])
50
+ TlmField1 = tlmItemFormat [tlmIndex ]
51
+ if TlmField1 [:1 ] == "<" :
52
+ TlmField1 = TlmField1 [1 :]
53
+ TlmField2 = datagram [int (tlmItemStart [tlmIndex ]):(int (tlmItemStart [tlmIndex ]) + int (tlmItemSize [tlmIndex ]))]
54
+ TlmField = unpack ( TlmField1 , TlmField2 )
51
55
if tlmItemDisplayType [tlmIndex ] == 'Dec' :
52
56
valueField .setText (str (TlmField [0 ]))
53
57
elif tlmItemDisplayType [tlmIndex ] == 'Hex' :
54
58
valueField .setText (hex (TlmField [0 ]))
55
59
elif tlmItemDisplayType [tlmIndex ] == 'Enm' :
56
60
valueField .setText (tlmItemEnum [tlmIndex ][int (TlmField [0 ])])
57
61
elif tlmItemDisplayType [tlmIndex ] == 'Str' :
58
- valueField .setText (TlmField [0 ])
62
+ valueField .setText (TlmField [0 ]. decode ( 'utf-8' , 'ignore' ) )
59
63
labelField .setText (tlmItemDesc [tlmIndex ])
60
64
else :
61
65
labelField .setText ("(unused)" )
@@ -135,13 +139,14 @@ def __init__(self, mainWindow, subscription):
135
139
self .context = zmq .Context ()
136
140
self .subscriber = self .context .socket (zmq .SUB )
137
141
self .subscriber .connect ("ipc:///tmp/GroundSystem" )
138
- self .subscriber .setsockopt (zmq .SUBSCRIBE , subscription )
142
+ myTlmPgAPID = subscription .split ("." ,1 )
143
+ mySubscription = "GroundSystem.Spacecraft1.TelemetryPackets." + str (myTlmPgAPID [1 ])
144
+ self .subscriber .setsockopt_string (zmq .SUBSCRIBE , mySubscription )
139
145
140
146
def run (self ):
141
147
while True :
142
148
# Read envelope with address
143
149
[address , datagram ] = self .subscriber .recv_multipart ()
144
- #print("[%s] %s" % (address, datagram))
145
150
# Send signal with received packet to front-end/GUI
146
151
self .emit (self .signalTlmDatagram , datagram )
147
152
@@ -150,9 +155,9 @@ def run(self):
150
155
# Display usage
151
156
#
152
157
def usage ():
153
- print "Must specify --title=<page name> --port=<udp_port> --appid=<packet_app_id(hex)> --endian=<endian(L|B) --file=<tlm_def_file> --sub=<subscriber_string>"
154
- print " example: --title=Executive Services --port=10800 --appid=800 --file=cfe-es-hk-table.txt --endian=L --sub=GroundSystem.Spacecraft1.0x886"
155
- print " (quotes are not on the title string in this example)"
158
+ print ( "Must specify --title=<page name> --port=<udp_port> --appid=<packet_app_id(hex)> --endian=<endian(L|B) --file=<tlm_def_file> --sub=<subscriber_string>" )
159
+ print ( " example: --title=Executive Services --port=10800 --appid=800 --file=cfe-es-hk-table.txt --endian=L --sub=GroundSystem.Spacecraft1.0x886" )
160
+ print ( " (quotes are not on the title string in this example)" )
156
161
157
162
#
158
163
# Main
@@ -198,7 +203,7 @@ def usage():
198
203
if len (subscription ) == 0 :
199
204
subscription = "GroundSystem"
200
205
201
- print 'Generic Telemetry Page started. Subscribed to ' + subscription
206
+ print ( 'Generic Telemetry Page started. Subscribed to ' + subscription )
202
207
203
208
if endian == 'L' :
204
209
py_endian = '<'
@@ -225,7 +230,7 @@ def usage():
225
230
tlmItemEnum = [[] for i in range (40 )]
226
231
i = 0
227
232
228
- with open (tlmDefFile , 'rb ' ) as tlmfile :
233
+ with open (tlmDefFile , 'r ' ) as tlmfile :
229
234
reader = csv .reader (tlmfile , skipinitialspace = True )
230
235
for row in reader :
231
236
if row [0 ][0 ] != '#' :
0 commit comments