示例#1
0
class CarberryObdConnection(object):
    """
    Class for OBD connection. Use a thread for the connection.
    """
    
    def __init__(self):
        self.capture = CarberryObdCapture()

    def get_capture(self):
        return self.capture

    def connect(self):
        self.t = Thread(target=obd_connect, args=(self.capture,))
        self.t.start()

    def is_connected(self):
        return self.capture.is_connected()

    def get_output(self):
        if self.capture and self.capture.is_connected():
            return self.capture.capture_data()
        return ""

    def get_port(self):
        return self.capture.is_connected()

    def get_port_name(self):
        if self.capture:
            port = self.capture.is_connected()
            if port:
                try:
                    return port.port.name
                except:
                    pass
        return None
    
    def get_sensors(self):
        sensors = []
        if self.capture:
            sensors = self.capture.get_supported_sensors()
        return sensors
示例#2
0
class CarberryObdConnection(object):
    """
    Class for OBD connection. Use a thread for the connection.
    """
    def __init__(self):
        self.capture = CarberryObdCapture()

    def get_capture(self):
        return self.capture

    def connect(self):
        self.t = Thread(target=obd_connect, args=(self.capture, ))
        self.t.start()

    def is_connected(self):
        return self.capture.is_connected()

    def get_output(self):
        if self.capture and self.capture.is_connected():
            return self.capture.capture_data()
        return ""

    def get_port(self):
        return self.capture.is_connected()

    def get_port_name(self):
        if self.capture:
            port = self.capture.is_connected()
            if port:
                try:
                    return port.port.name
                except:
                    pass
        return None

    def get_sensors(self):
        sensors = []
        if self.capture:
            sensors = self.capture.get_supported_sensors()
        return sensors
示例#3
0
 def __init__(self):
     self.capture = CarberryObdCapture()
示例#4
0
 def __init__(self):
     self.capture = CarberryObdCapture()