#!/usr/bin/python from zocp import ZOCP import logging if __name__ == '__main__': zl = logging.getLogger("zocp") zl.setLevel(logging.DEBUG) z = ZOCP() z.set_name("ZOCP-Test") z.register_bool("myBool", True, 'rwe') z.register_float("myFloat", 2.3, 'rws', 0, 5.0, 0.1) z.register_int('myInt', 10, access='rwes', min=-10, max=10, step=1) z.register_percent('myPercent', 12, access='rw') z.register_vec2f('myVec2', [0,0], access='rwes') z.start() z.run() print("FINISH")
import gi from gi.repository import GObject from zocp import ZOCP import zmq GObject.threads_init() loop = GObject.MainLoop() z = ZOCP("GLibTest") z.register_percent('myPercent', 12, access='rw') def zocp_handle(*args, **kwargs): z.run_once() return True GObject.io_add_watch(z.inbox.getsockopt(zmq.FD), GObject.PRIORITY_DEFAULT, GObject.IO_IN, zocp_handle) z.start() try: loop.run() except Exception as e: print(e) finally: z.stop()