GitLab system status is available here and here

Commit 1fdb3cff authored by Singaravelavan Rajesh's avatar Singaravelavan Rajesh
Browse files

Init Push

parent b221af32
This diff is collapsed.
:020000040000fa
:020000041fc01b
:042ff400d9fff8ff0a
:020000040000fa
:020000041fc01b
:042ff8005b5960ffc2
:020000040000fa
:020000041fc01b
:042ffc00ffffff7f55
:020000040000fa
:020000041fc01b
:10000000029d1a3c00f05a2708004003000000003f
:020000040000fa
:020000041fc01b
:10038000029d1a3cfcf85a270800400300000000b8
:020000040000fa
:020000041fc01b
:10118000029d1a3c2cf85a2708004003000000007a
:020000040000fa
:020000041d01dc
:10f0000000601a40c0045a7f050040130000000051
:10f01000029d1a3c18f95a2708004003000000001e
:10f0200000a01d3cf03fbd2700a01c3cf07f9c27aa
:10f030000260094020582001801e2a7d8449497db4
:10f0400002608940c000000000e0dc4102608b40ab
:10f05000029d083c08f9082509f80001000000009d
:10f0600000a0083c0000082500a0093c1400292548
:10f070000600001000000000000000ad040000ad1c
:10f08000080000ad0c0000ad100008252b08090198
:10f09000f9ff201400000000029d083cd0fa08256a
:10f0a0000000098d180020110400082500000a8db9
:10f0b0000400082500000b8d0900601104000825dc
:10f0c00000000c91ffff4a250100082500002ca13b
:10f0d000fbff40150100292505000010000000007d
:10f0e000000020a1ffff4a25fdff40150100292552
:10f0f00003000825fcff0a24244048010000098d74
:10f10000e7ff2015000000000000093c0000292551
:10f1100010002011000000000000093c00402925db
:10f1200088bf0a3c10204a25000049ad0000093c78
:10f130000040292588bf0a3c20204a25000049ad0f
:10f140000000093c0040292588bf0a3c30204a25a0
:10f15000000049ad00488040ffff0a2400588a4063
:10f16000c09f093c00102925017889400000093c16
:10f170000100292500000a2444492a7d01608a40b3
:10f180008000093c00688940008008408005097db6
:10f19000404c0900006008405800013c2440010137
:10f1a0002540280100608840029d083c10f9082590
:10f1b00009f800010000000000600840bfff013caa
:10f1c000ffff2134244001010060884000008430aa
:10f1d0000000a530029d083ce4f10825080000016c
:10f1e000000000007d7c400f00000000ffff0010c9
:10f1f00000000000b0ffbd274c00bfaf927c400f65
:10f2000000000000aa7c400f00000000c404023c83
:10f2100000b442341000a2af2c0102241400a2afab
:10f22000020002241800a2afe80302241c00a2afcf
:10f230001f7d400f1000a427010002244c00bf8f47
:10f240000800e0035000bd2781bf023c00f2438c60
:10f25000c418037c00f243ac0100022488bf033cc5
:10f26000446162ac88bf033c746162ac88bf033cfc
:10f27000646162ac88bf033c686162ac0800e00373
:10f28000000000000068024000700240148082af5d
:10f29000a47c400b0000000080bf023c1060428c48
:10f2a0000800e0030100423080bf023c006040ac37
:10f2b00080bf023c106040ac1500042480bf033cba
:10f2c000406064ac80bf043c0060858c0100032476
:10f2d000c47b657c006085ac106040ac80bf023ca4
:10f2e0001060448c0463647c106044ac1060448cf7
:10f2f0008452647c106044ac0800e003000000000d
:10f30000e8ffbd271400bfafa67c400f000000003f
:10f31000fdff401080bf023c3060428cff00423055
:10f320001400bf8f0800e0031800bd27ff008430e1
:10f3300080bf033c1060628c00024230fdff40142d
:10f3400080bf023c206044ac0800e00300000000e5
:10f35000e0ffbd271c00bfaf1800b2af1400b1af73
:10f360001000b0af218080000900a0182190a000fb
:10f370002188000000000492cb7c400f0100102681
:10f38000010031262a103202fbff40540000049293
:10f390001c00bf8f1800b28f1400b18f1000b08f07
:10f3a0000800e0032000bd27e8ffbd271400bfaf21
:10f3b000cb7c400f000000001400bf8f0800e0036a
:10f3c0001800bd27e8ffbd271400bfaf009d023c19
:10f3d0000000438cffff022405006210009d023ce8
:10f3e00009f8400000000000ff7c400b1400bf8fb4
:10f3f0004f7e400f000000001400bf8f0800e003a4
:10f400001800bd27e8ffbd271400bfaf1000b0af44
:10f41000218080002080828f0000448cd57d400fa9
:10f420001880858f117d400b00000000e17d400faa
:10f43000000000000300401000000000f17c400fbd
:10f4400000000000a67c400f00000000f7ff401005
:10f4500000000000c07c400f00000000030000120c
:10f460001c808393211843001c8083a31400bf8f4a
:10f470001000b08f0800e0031800bd27c0fdbd27b5
:10f480003c02bfaf3802b7af3402b6af3002b5afff
:10f490002c02b4af2802b3af2402b2af2002b1af46
:10f4a0001c02b0af208084af0400828c188082af31
:10f4b00021800000c1001124017d400f21200000a7
:10f4c0000900511001001026ff0010322080828fa9
:10f4d0000800428c2b100202f7ff401400000000cd
:10f4e000f17c400f000000002080828f0c00428cd5
:10f4f000188082afcb7c400f18000424cb7c400fd7
:10f5000005000424cb7c400f82000424ea7c400fd9
:10f510004b00042481bf143c0e00163c1f30d6263d
:10f52000009d153c0002b72600f4828e0030423068
:10f53000040040501c8080a3647e400f0000000047
:10f540001c8080a3017d400f01000424218840001d
:10f55000017d400f0100042421804000017d400f07
:10f56000010004241000a2a31100b0a31200b1a353
:10f570001300a0a31000b38f017d400f01000424ed
:10f5800021904000017d400f01000424ffff512421
:10f59000801011000200433a0a8843000b00201239
:10f5a0000000000021800000017d400f01000424c4
:10f5b0001400a42721189000000062a0010010266a
:10f5c0002b101102f8ff401400000000017d400fd5
:10f5d000212000001c80839321184300ff0063302a
:10f5e0000500601002000224ea7c400f4e00042453
:10f5f0004a7d400b000000002a0042120300422e08
:10f6000006004010080002240100022449004216ae
:10f6100000e3023c8d7d400b211062023700421254
:10f62000410002244300421621807502c37d400b35
:10f630002188770202130200120056100000000019
:10f640006b7e400f2120750200f4828e0030423024
:10f650002b10020007004014000000000d004014b1
:10f6600000000000ea7c400f4b0004244a7d400b60
:10f6700000000000ea7c400f560004244a7d400b45
:10f6800000000000ea7c400f500004244a7d400b3b
:10f6900000000000ea7c400f550004244a7d400b26
:10f6a0000000000000e3023c21106202021302008d
:10f6b0000e00561021887502212020029d7e400fe9
:10f6c0001400a5271400a42721282002e57d400f5f
:10f6d000000206241b00401400000000ea7c400fda
:10f6e0004b0004244a7d400b00000000ea7c400fe0
:10f6f000500004244a7d400b00000000ea7c400fcb
:10f70000550004244a7d400b000000002120000227
:10f71000d47c400f0800052408001026fcff1116b9
:10f7200021200002ea7c400f4b0004244a7d400b5c
:10f7300000000000ea7c400f550004244a7d400b85
:10f7400000000000ea7c400f560004244a7d400b74
:10f7500000000000e8ffbd271400bfaf6210023cac
:10f76000d34d42241900820010200000c221040061
:10f770004c7e400f0220a4701400bf8f0800e003ed
:10f780001800bd2788bf023c3010428c0800e003ff
:10f79000010042300400c9280500201121388600ec
:10f7a0001700c01c000000000800e003211000004a
:10f7b000254085000300083103000011000000000f
:10f7c00010000010000088900000888c0000a98cb8
:10f7d00004008424050009110400a524fcffa524cd
:10f7e000fcff84240700001000008890fcffc62462
:10f7f000f5ffc01c000000000800e003211000001d
:10f80000000088900000a9900100842403000911e1
:10f810000100a5240800e00323100901f8ff871464
:10f82000000000000800e00321100000a8ffbd2731
:10f830000400a1af0800a2af0c00a3af1000a4af5a
:10f840001400a5af1800a6af1c00a7af2000a8affa
:10f850002400a9af2800aaaf2c00abaf3000acaf9a
:10f860003400adaf3800aeaf3c00afaf4000b8af32
:10f870004400b9af4800bfaf124000004c00a8af31
:10f88000104000005000a8af006804400060054030
:10f89000a17c400f000000005000a88f1100000163
:10f8a0004c00a88f130000010400a18f0800a28f54
:10f8b0000c00a38f1000a48f1400a58f1800a68f32
:10f8c0001c00a78f2000a88f2400a98f2800aa8fd2
:10f8d0002c00ab8f3000ac8f3400ad8f3800ae8f72
:10f8e0003c00af8f4000b88f4400b98f4800bf8ff5
:10f8f0005800bd27c0000000180000423f00007003
:10f90000407e400b000000000800e0030000000003
:10f910000800e0030000000000601a40bfff1b3c2d
:10f92000ffff7b3724d05b0300609a401800004241
:10f93000004880400800e00300588440e8ffbd27ed
:10f940001400bfaf627e400f0000000099aa033c84
:10f9500081bf023c5566632430f240ac30f243acc8
:10f960006655033caa99633430f243ac81bf023c34
:10f970000100032418f643ac81bf023c10f6428c10
:10f98000607e400b000000000800e0030060624160
:10f99000e8ffbd271400bfaf767e400f004004246f
:10f9a0001400bf8f0800e0031800bd27e8ffbd2743
:10f9b00000e0837c81bf023c044004241400bfaffc
:10f9c00020f443ac767e400f000000001400bf8f8f
:10f9d0000800e0031800bd27e8ffbd271000b0af06
:10f9e000218080001400bfaf627e400f00401036bf
:10f9f00081bf053c00f4b0ac00480640004803401d
:10fa000023186600f000632cfcff601499aa043ce4
:10fa100081bf033c5566842410f464ac6655043cf5
:10fa2000aa99843410f464ac0080043481bf033c90
:10fa300008f464ac00f4a38c00806330fdff601414
:10fa4000212040000040032481bf023c04f443ac69
:10fa5000ab7e400f0000000081bf023c00f4428cee
:10fa60001400bf8f1000b08f003042300800e00358
:10fa70001800bd2700e0827c81bf033ce8ffbd2762
:10fa800020f462ac00e0a57c81bf023c034004246a
:10fa90001400bfaf40f445ac767e400f000000007c
:10faa0001400bf8f0800e0031800bd270100843058
:10fab00003008014000000000800e00300606041c3
:08fac0000800e0032060604132
:020000040000fa
:020000041d01dc
:10fad000000000a00800000000000000080000a0d6
:0cfae00008000000000000000000000012
:00000001FF
import serial
import threading
import queue
import serial.tools.list_ports
import functools
import time
RAWQUEUESIZE = 2048
class UsbSerial(object):
def __init__(self, Port = None, BaudRate = 115200):
# store the port info in instance variables
self.Port = Port
self.BaudRate = BaudRate
# set up the dictionary of queues
self.receivedBytesQueues = list()
# set up the list for error handlers
self.errorBackList = list()
# set up list for outgoing messages
self.outMessageCallBacks = list()
# set up queue for outgoing serial as the serial write is blocking
self.outputQueue = queue.Queue()
# count packets
self.packetCountReceiving = 0
self.packetCountSending = 0
# connect to the port but first set the activeFlag and create a ref to the port
self.activeConnection = False
self.serialPort = None
self.Connect()
# need a flag for auto-connect
self.autoReConnect = False
# clear the buffer
if self.activeConnection:
self.serialPort.reset_input_buffer()
self.serialPort.reset_output_buffer()
# set up the threaded input buffer
self.incomingThread = threading.Thread(target=self.handleIncoming, name='IncomingHandler')
self.incomingThread.daemon = True
self.incomingThread.start()
# set up the threaded output buffer
self.outputThread = threading.Thread(target=self.handleOutGoing, name='outgoingHandler')
self.outputThread.daemon = True
self.outputThread.start()
return
@staticmethod
def listSerialPorts():
return [potPort.device for potPort in serial.tools.list_ports.comports()]
def Connect(self):
# we will handle the no port case here
if self.Port is None:
for potPort in serial.tools.list_ports.comports():
if potPort.device == 'COM1':
continue
self.Port = potPort.device
if self.Port is None:
self.activeConnection = False
return False
else:
try:
# open the serial port
self.serialPort = serial.Serial()
self.serialPort.baudrate = self.BaudRate
self.serialPort.port = self.Port
# self.serialPort.dtr = None
self.serialPort.open()
self.activeConnection = True
return True
except serial.serialutil.SerialException:
pass
return False
def Disconnect(self):
if self.activeConnection:
self.activeConnection = False
self.serialPort.close()
self.autoReConnect = False
return True
else:
return False
def registerQueue(self, inQueue):
if type(inQueue) is not queue.Queue:
return False
else:
self.receivedBytesQueues.append(inQueue)
return True
# def deregisterMessageHandler(self, messageID, functionPointer):
# if type(messageID) is not MessageIDs:
# return False
# if messageID.value in self.callBackDict:
# self.callBackDict[messageID.value].remove(functionPointer)
# return True
# def registerOutGoingMessageHandler(self, functionPointer):
# """gets a callback on outgoing messages, this is for all messages, up to application to filter"""
# self.outMessageCallBacks.append(functionPointer)
def registerErrorHandler(self, functionPointer):
"""this is for errors in the serial stream, not in the packets"""
self.errorBackList.append(functionPointer)
return
def handleIncoming(self):
"""This is the threaded instance that actually handles the protocol"""
# rawQueue = list()
while True:
if not self.activeConnection:
if self.autoReConnect:
self.Connect()
time.sleep(.1)
continue
try:
curChar = self.serialPort.read(1)
except serial.serialutil.SerialException as e:
self.handleError(e)
continue
for curQueue in self.receivedBytesQueues:
curQueue.put(curChar, block=False)
return
def handleOutGoing(self):
while True:
if self.activeConnection:
try:
newByte = self.outputQueue.get()
self.serialPort.write(newByte.to_bytes(1, byteorder='big'))
except serial.serialutil.SerialException as e:
self.handleError(e)
pass
else:
time.sleep(.1)
return
def handleError(self, inException):
self.activeConnection = False
# print(inException)
for fp in self.errorBackList:
fpThread = threading.Thread(target=functools.partial(fp, (inException)))
fpThread.daemon = True
fpThread.start()
return
def sendBytes(self, message):
for x in message:
self.outputQueue.put(x, block=False)
return
def setAutoConnectMode(self, reconnectMode):
self.autoReConnect = reconnectMode
return
if __name__ == "__main__":
import time
import random
import queue
portInstance = UsbSerial()
print("Port: {} Baudrate: {} Active: {}".format(portInstance.Port, portInstance.BaudRate, portInstance.activeConnection))
tempQueue = queue.Queue()
portInstance.registerQueue(tempQueue)
while True:
while not tempQueue.empty():
print(tempQueue.get().decode('ascii'), end='')
time.sleep(.1)
from PyQt5.QtCore import *
from PyQt5.QtGui import *
from PyQt5.QtWidgets import *
import PyQt5
widgetName = "UsbSerial Control"
class SerialControl(QWidget):
def __init__(self, portInstance, parent=None):
super(SerialControl, self).__init__(parent)
self.portInstance = portInstance
self.lastError = None
self.usedLayout = QVBoxLayout()
self.setLayout(self.usedLayout)
statusGrid = QGridLayout()
statusGrid.addWidget(QLabel("UsbSerial Port: "), 0, 0)
self.serialPortSelection = QComboBox()
statusGrid.addWidget(self.serialPortSelection, 0, 1)
self.rescanPorts()
statusGrid.addWidget(QLabel("Baud Rate: "), 1, 0)
self.baudRateLabel = QLabel(str(self.portInstance.BaudRate))
statusGrid.addWidget(self.baudRateLabel, 1, 1)
statusGrid.addWidget(QLabel("Status: "), 2, 0)
self.connectionStatusLabel = QLabel("N/A")
statusGrid.addWidget(self.connectionStatusLabel, 2, 1)
statusGrid.addWidget(QLabel("Last Error: "), 3, 0)
self.lastErrorLabel = QLabel(str(None))
statusGrid.addWidget(self.lastErrorLabel, 3, 1)
statusGrid.setColumnStretch(2, 1)
self.usedLayout.addLayout(statusGrid)
self.connectButton = QPushButton("Connect")
self.connectButton.clicked.connect(self.connect)
self.disconnectButton = QPushButton("Disconnect")
self.disconnectButton.clicked.connect(self.disconnect)
self.toggleAutoConnect = QCheckBox("Auto Reconnect")
self.toggleAutoConnect.setChecked(self.portInstance.autoReConnect)
self.toggleAutoConnect.clicked.connect(self.setReconnect)
compression = QHBoxLayout()
compression.addWidget(self.connectButton)
compression.addWidget(self.disconnectButton)
compression.addWidget(self.toggleAutoConnect)
compression.addStretch()
self.usedLayout.addLayout(compression)
self.rescanPortsButton = QPushButton("Rescan Ports")
self.rescanPortsButton.setSizePolicy(QSizePolicy.Maximum, QSizePolicy.Maximum)
self.usedLayout.addWidget(self.rescanPortsButton, Qt.AlignLeft)
self.rescanPortsButton.clicked.connect(self.rescanPorts)
# self.usedLayout.addLayout(compression)
self.portInstance.registerErrorHandler(self.recordError)
self.usedLayout.addStretch()
self.updateStatus()
self.Timer = QTimer()
self.Timer.timeout.connect(self.updateStatus)
self.Timer.start(100)
return
def updateStatus(self):
"""this updates the status of the port and also enables/disables controls as appropriate"""
if self.portInstance.activeConnection:
# print("we are active")
self.serialPortSelection.setDisabled(True)
self.connectButton.setDisabled(True)
self.disconnectButton.setDisabled(False)
self.rescanPortsButton.setDisabled(True)
self.connectionStatusLabel.setText("Connected")
else:
self.serialPortSelection.setDisabled(False)
self.connectButton.setDisabled(False)
self.disconnectButton.setDisabled(True)
self.rescanPortsButton.setDisabled(False)
if self.portInstance.Port is not None:
self.connectionStatusLabel.setText("Disconnected")
else:
self.connectionStatusLabel.setText("No Port Available")
# print("inactive")
if self.lastError is not None:
if str(self.lastError) != self.lastErrorLabel.text():
self.lastErrorLabel.setText(str(self.lastError))
return
def connect(self):
if self.serialPortSelection.currentText() != self.portInstance.Port:
self.portInstance.Port = self.serialPortSelection.currentText()
self.portInstance.Connect()
self.updateStatus()
return
def disconnect(self):
self.portInstance.Disconnect()
self.toggleAutoConnect.setChecked(False)
self.updateStatus()
return
def recordError(self, inException):
self.lastError = inException
# self.updateStatus()
return
def rescanPorts(self):
availablePorts = self.portInstance.listSerialPorts()
self.serialPortSelection.clear()
self.serialPortSelection.addItems(availablePorts)
if self.serialPortSelection.findText(self.portInstance.Port) != -1:
self.serialPortSelection.setCurrentIndex(self.serialPortSelection.findText(self.portInstance.Port))
return
def setReconnect(self):
self.portInstance.setAutoConnectMode(self.toggleAutoConnect.isChecked())
return
from PyQt5.QtCore import *
from PyQt5.QtGui import *
from PyQt5.QtWidgets import *
import queue
from ece118 import UsbSerial
widgetName = "Serial I/O"
refreshRate = 20
class serialInput(QPlainTextEdit):
def __init__(self):
super().__init__(parent=None)
return
def createMimeDataFromSelection(self):
returnType = QMimeData()
rawSelection = self.textCursor().selectedText()
rawSelection = rawSelection.replace("\u2029", "\n")
rawSelection = rawSelection.replace("\x00", "")
returnType.setText(rawSelection)
return returnType
class SerialIO(QWidget):
def __init__(self, portInstance, parent=None):
super(SerialIO, self).__init__(parent)
self.portInstance = portInstance
self.usedLayout = QVBoxLayout()
self.setLayout(self.usedLayout)
inputBox = QHBoxLayout()
self.usedLayout.addLayout(inputBox)
self.serialAsciiOutput = QLineEdit()
inputBox.addWidget(self.serialAsciiOutput)
self.serialAsciiOutput.returnPressed.connect(self.sendAscii)
self.newLineAddCheck = QCheckBox(r"Add New Line (\n)")
inputBox.addWidget(self.newLineAddCheck)
self.serialInput = serialInput()
self.serialInput.setReadOnly(True)
self.usedLayout.addWidget(self.serialInput)
self.clearButton = QPushButton("Clear")
self.usedLayout.addWidget(self.clearButton)
self.clearButton.clicked.connect(self.serialInput.clear)
self.serialInQueue = queue.Queue()
self.portInstance.registerQueue(self.serialInQueue)
self.serialChecker = QTimer()
self.serialChecker.timeout.connect(self.updateOutput)
self.serialChecker.start(refreshRate)
def updateOutput(self):
newLine = bytes()
if not