Skip to main content

Python QSYS QRC Wrapper

Project description

Python QSYS QRC Wrapper

  • Control QSC QSYS Core devices with python

ToDo

  • Flaskify...
  • Document, document, document

Use

  • For each QSC Core on the network instantiate a "Core" class
  • When adding control objects they will "cast" themselves to the parent core class
    • The parent Core class instance is required as keyword arg "parent" when creating control objects
#!/usr/bin/python3
import time
from qsys.classes import Core,Control,ChangeGroup

#returns epoch time
from qsys.helpers import epoch

def main():
    #See qsys.py for parameters in Core class
    #The initiail EngineStatus response parameters from the device will get added to Core.__dict__
    #You can pass "port" as well, but it defaults to 1710
    myCore = Core(Name='myCore',User='',Password='',ip='192.168.61.2')

    #Open the socket,creates "listen" and "keepalive" threads
    myCore.start()

    #ValueType can be a list of potential value types [int,float] or a single type "str" etc
    #This object is assumed to be a "gain" control object, so we can pass [int,float]
    gainControlObject = Control(parent=myCore,Name='namedControlInQsysDesigner',ValueType=[int,float])

    #To constantly monitor the state of your object use a ChangeGroup
    #You need to a ChangeGroup instance to add control objects and set polling rates
    #Parameters that are capitalize are that way because of the QRC parameter protocol
    #Id in this case is just the name of the ChangeGroup
    myChangeGroup = ChangeGroup(parent=myCore,Id='myChangeGroup')
    myChangeGroup.AddControl(gainControlObject)

    #Allow the socket time to connect and parse the initial responses
    time.sleep(2)

    #Set the change group auto poll rate
    #This rate is fast, your mileage may vary
    myChangeGroup.AutoPoll(Rate=0.1)

    #Value = value to set object to
    #TransId = QRC id parameter for transaction ID
    gainControlObject.set(Value=10,TransId=epoch())

    while True:
        print(gainControlObject.state)
        time.sleep(1)

if __name__ == '__main__':
    main()

Notes

  • In development, versions will change rapidly. This version doesn't do much yet.. stand by

References

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

qsys-0.0.4.tar.gz (5.6 kB view details)

Uploaded Source

Built Distribution

qsys-0.0.4-py3-none-any.whl (6.6 kB view details)

Uploaded Python 3

File details

Details for the file qsys-0.0.4.tar.gz.

File metadata

  • Download URL: qsys-0.0.4.tar.gz
  • Upload date:
  • Size: 5.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.0 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.8.5

File hashes

Hashes for qsys-0.0.4.tar.gz
Algorithm Hash digest
SHA256 ad188b65aa64c4bee7e3ba1794116c3d6cc72fd255871962e516a9a13999731f
MD5 713b870c1dd85289a2c54b34c498a5e9
BLAKE2b-256 0a7106e8f2cd28391cbde3672727185e033090f7317d2fe95922c7b82ecf0e30

See more details on using hashes here.

File details

Details for the file qsys-0.0.4-py3-none-any.whl.

File metadata

  • Download URL: qsys-0.0.4-py3-none-any.whl
  • Upload date:
  • Size: 6.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.0 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.8.5

File hashes

Hashes for qsys-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 acd647f9144e0b22e92f2adfcf04a3c09b774560c1faff755d9e0cbb97e65494
MD5 28b3a52d964f2b7c5ada9d5882947ab2
BLAKE2b-256 b0c91a233a83b2749675f7130c899de6754735b72b43f933df6390b97a44d36f

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page