quarchpy.connection_specific package¶
Subpackages¶
Submodules¶
quarchpy.connection_specific.connection_QIS module¶
- class quarchpy.connection_specific.connection_QIS.QisInterface(host='127.0.0.1', port=9722, connectionMessage=True)¶
Bases:
object
- GetQisModuleSelection(favouriteOnly=True, additionalOptions=['rescan', 'all con types', 'ip scan'], scan=True)¶
Fuction used to list the available deviced to QIS and present them to the user for selection.
Returns myDeviceID - Str the connection string used to connect to the selected device.
- add_header_to_buffer(outBuffer, return_b_array, stream_header_size, temp_dict)¶
- add_header_to_byte_array(return_b_array, stream_header_size, temp_dict, tree, is_digital=False)¶
- averageStripes(leftover, streamAverage, newStripes, f, remainingStripes=[])¶
- avgStringFromPwr(avgPwrTwo)¶
- closeConnection(sock=None, conString=None)¶
- connect(connectionMessage=True)¶
Connect() tries to open a socket on the host and port specified in the objects variables If successful it returns the backends welcome string. If it fails it returns a string saying unable to connect The backend should be running and host and port set before running this function. Normally it should be called at the beggining of talking to the backend and left open until finished talking when the disconnect() function should be ran
Param: connectionMessage: boolean, optional
Set to False if you don’t want a warning message to appear when an instance is already running on that port. Useful when using isQisRunning() from qisFuncs
- convertStreamAverage(streamAveraging)¶
- create_dir_structure(module, directory=None)¶
Creates the QPS directory structure and (empty) files to be written to
I’ve put a bunch of try-except just to be sure the directory is correctly created. ( There’s probably a better way of doing this than this )
- Param:
module: String - Module string
- Param:
directory: String - Name of directory for QPS stream (defaults to default recording location if invalid)
- Returns:
success: Boolean - Was the file structure created successfully?
- create_index_file()¶
Create the necessary index file for QPS data000.idx
For future revisions, this should be updated if there are file limits on each data file Current implementation assumes only 1 of each data file are made.
No Return./
- create_index_file_digitals()¶
Create the necessary index file for QPS data101.idx
For future revisions, this should be updated if there are file limits on each data file Current implementation assumes only 1 of each data file are made.
No Return.
- create_qps_directory(directory)¶
- create_qps_file(module)¶
Creates the end QPS file that is used to open QPS
- Parameters:
module – Module QTL number that was used for the stream
- Returns:
- deviceDictSetup(module)¶
- deviceMulti(device)¶
- disconnect()¶
- getDeviceList(sock=None)¶
- getStreamXmlHeader(device, sock=None)¶
- get_list_details(sock=None)¶
- interruptList()¶
- isXmlHeader(headerText)¶
- qis_scan_devices(scan=True, favouriteOnly=True, ipAddress=None)¶
- receiveText(sock)¶
- rxBytes(sock)¶
- scanIP(ipAddress)¶
Triggers QIS to look at a specific IP address for a quarch module
- Parameters:
QisConnection (QpsInterface) – The interface to the instance of QPS you would like to use for the scan.
ipAddress (str) – The IP address of the module you are looking for eg ‘192.168.123.123’
sleep (int, optional) – This optional variable sleeps to allow the network to scan for the module before allowing new commands to be sent to QIS.
- sendAndReceiveCmd(sock=None, cmd='$help', device='', readUntilCursor=True, betweenCommandDelay=0.0)¶
- sendAndReceiveText(sock, sentText='$help', device='', readUntilCursor=True)¶
- sendCmd(device='', cmd='$help', sock=None, readUntilCursor=True, betweenCommandDelay=0.0, expectedResponse=True)¶
Send command is used to send a command to QIS and as far as I can see it has no difference than sendAndReceiveCmd
- sendCommand(cmd, device='', timeout=20, sock=None, readUntilCursor=True, betweenCommandDelay=0.0, expectedResponse=True)¶
Send command is used to send a command to QIS and as far as I can see it has no difference than sendAndReceiveCmd
- sendText(sock, message='$help', device='')¶
- sortFavourite(foundDevices)¶
- startStream(module, fileName, fileMaxMB, streamName, streamAverage, releaseOnData, separator, streamDuration=None, inMemoryData=None)¶
- startStreamQPS(module, fileName, fileMaxMB, streamName, streamAverage, releaseOnData, separator)¶
- startStreamThread(module, fileName, fileMaxMB, streamName, streamAverage, releaseOnData, separator, streamDuration=None, inMemoryData=None)¶
- startStreamThreadQPS(module, fileName, fileMaxMB, streamName, streamAverage, releaseOnData, separator)¶
- stopStream(module, blocking=True)¶
- streamBufferStatus(device, sock=None)¶
- streamGetStripesText(sock, device, numStripes=4096, skipStatusCheck=False)¶
- streamHeaderAverage(device, sock=None)¶
- streamHeaderFormat(device, sock=None)¶
- streamHeaderVersion(device, sock=None)¶
- streamInterrupt()¶
- streamRunningStatus(device, sock=None)¶
- waitStop()¶
- write_b_array_to_idx_file(f, return_b_array)¶
- write_stripe_to_files_HD(stripe)¶
- write_stripe_to_files_PAM(stripe)¶
- quarchpy.connection_specific.connection_QIS.strToBb(string_in, add_length=True)¶
quarchpy.connection_specific.connection_QPS module¶
- class quarchpy.connection_specific.connection_QPS.QpsInterface(host='127.0.0.1', port=9822)¶
Bases:
object
- closeConnection(conString=None)¶
- connect(targetDevice)¶
- disconnect(targetDevice)¶
- getDeviceList(scan=True, ipAddress=None)¶
- get_list_details(sock=None)¶
- open_recording(file_path, cmdTimeout=5, pollInterval=3, startOpenTimout=5)¶
- recv()¶
- scanIP(ipAddress, sleep=10)¶
Triggers QPS to look at a specific IP address for a quarch module
- Parameters:
QpsConnection (QpsInterface) – The interface to the instance of QPS you would like to use for the scan.
ipAddress (str) – The IP address of the module you are looking for eg ‘192.168.123.123’
sleep (int, optional) – This optional variable sleeps to allow the network to scan for the module before allowing new commands to be sent to QPS.
- send(data)¶
- sendCmdVerbose(cmd, timeout=20)¶
- sendCommand(cmd, timeout=20, expectedResponse=True)¶
quarchpy.connection_specific.connection_ReST module¶
quarchpy.connection_specific.connection_Serial module¶
- class quarchpy.connection_specific.connection_Serial.SerialConn(ConnTarget)¶
Bases:
object
- close()¶
- sendCommand(Command, expectedResponse=True)¶
- quarchpy.connection_specific.connection_Serial.serial_read_until(Port, Char, Timeout)¶
quarchpy.connection_specific.connection_TCP module¶
quarchpy.connection_specific.connection_Telnet module¶
quarchpy.connection_specific.connection_USB module¶
- class quarchpy.connection_specific.connection_USB.TQuarchUSB_IF(context)¶
Bases:
object
- BulkRead()¶
- BulkReadEP(ep, n)¶
- BulkReadEPTout(ep, n, timeOut)¶
- BulkReadN(n)¶
- CheckComms()¶
- ClosePort()¶
- DebugDump()¶
- FetchCmdReply()¶
- FetchCmdReplyTOut(timeout)¶
- GetExtendedInfo()¶
- GetIdn()¶
- GetLastError()¶
- GetSerialNumber()¶
- IsPortOpen()¶
- OpenPort()¶
- RunCommand(command, expectedResponse=True)¶
- SendCommand(command)¶
- SetTimeout(timeout)¶
- VerboseSendCmd(cmd)¶
- WriteZeroPacketCmd()¶
- clean_and_flush_stuck_usb_comms()¶
USB comms can become stuck if a command is sent out too quickly after the end of the previous one If this is the case, the module response buffer contains data which needs flushed. This command triggers a buffer return and performs a full read of all data. If possible, it returns the response of the previous command which caused the stuck buffer.
- lockUSBStr = '\x02\x00\x00\x01\x04\x01'¶
- unlockUSBStr = '\x02\x00\x00\x01\x03\x00'¶
- quarchpy.connection_specific.connection_USB.USB(SerID='')¶
- class quarchpy.connection_specific.connection_USB.USBConn(ConnTarget)¶
Bases:
object
- close()¶
- sendCommand(Command, expectedResponse=True)¶
- quarchpy.connection_specific.connection_USB.getUSBDeviceSerialNo(context, device)¶
- quarchpy.connection_specific.connection_USB.importUSB(version='None')¶