Ejemplo n.º 1
0
                try:
                    monitor_status = responses[0]
                    dtc_count = monitor_status.dtc_count
                except Exception as e:
                    unexpected_error(e)

            for r in responses:
                print "%s: %s" % (r.bus_message.header, str(r))

        if pid_support + 0x20 not in supported_pids:
            # stop if no higher pid_support queries are supported
            break
    return


define_protocol_tests(globals())

dtc_count = 0


def do_test(filename=None):
    elm = create_test_elm(filename)
    try:
        elm.open()
        elm.set_protocol(None)
        elm.connect_to_vehicle()
    except Exception as e:
        unexpected_error(e)
        # if the connection fails, everything else will too
        return
# To negotiate alternative licensing terms, please contact the author.
# See the LICENSE.txt file at the top of the source tree for further
# information.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with pyOBD-II.  If not, see <http://www.gnu.org/licenses/>.
########################################################################

from testharness import create_test_port, define_protocol_tests

define_protocol_tests(globals(), protocols=["elm"])


def do_test(filename=None):
    import obd.interface.elm

    port = create_test_port(filename)
    baud = obd.interface.elm.ELM32X.detect_baudrate(port)
    print baud


if __name__ == "__main__":
    do_test()

# vim: softtabstop=4 shiftwidth=4 expandtab
Ejemplo n.º 3
0
    read_all_supported_pids(elm, sid)
    return

def read_dtcs(elm, sid):
    try:
        responses = elm.send_request(OBDRequest(sid=sid))
        for r in responses:
            print "%s: %s" % (r.bus_message.header, str(r))
    except obd.exception.DataError:
        pass
    except Exception as e:
        unexpected_error(e)
    return


define_protocol_tests(globals())


def do_test(filename=None):
    elm = create_test_elm(filename)
    try:
        elm.open()
        elm.set_protocol(None)
        elm.connect_to_vehicle()
    except Exception as e:
        unexpected_error(e)
        # if the connection fails, everything else will too
        return

    read_all_supported_pids(elm, 0x01)
# To negotiate alternative licensing terms, please contact the author.
# See the LICENSE.txt file at the top of the source tree for further
# information.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with pyOBD-II.  If not, see <http://www.gnu.org/licenses/>.
########################################################################

from testharness import create_test_port, define_protocol_tests

define_protocol_tests(globals(), protocols=["elm"])

def do_test(filename=None):
    import obd.interface.elm

    port = create_test_port(filename)
    baud = obd.interface.elm.ELM32X.detect_baudrate(port)
    print baud

if __name__ == "__main__":
    do_test()


# vim: softtabstop=4 shiftwidth=4 expandtab