コード例 #1
0
    def setUp(self):
        self.vdev = subprocess.Popen(
            ['virtual_device', 'bled112', 'report_test'])

        bleds = BLED112Adapter.find_bled112_devices()
        print(bleds)
        self.hw = HardwareManager(port='bled112:{}'.format(bleds[1]))
コード例 #2
0
        exit("This script must be run as root")

    if not shutil.which("dfu-util"):
        exit("Requires the dfu-util utility")


if __name__ == "__main__":

    check_pre_requisites()

    parser = argparse.ArgumentParser()
    parser.add_argument("blob", nargs='?', default="bled112-v1-6-0-virtual.raw")
    parser.add_argument("-n", "--num", help="Number of expected bled devices", required=False, type=int)
    args = parser.parse_args()

    unreset_bleds = BLED112Adapter.find_bled112_devices()

    if args.num and args.num != len(unreset_bleds):
        print("Error: Did not find expected number of bleds. Expected:", args.num, "Found:", len(unreset_bleds))
        exit(1)

    if args.num:
        total_num_to_flash = args.num
    else:
        total_num_to_flash = len(unreset_bleds)

    print("Resetting each dongle")
    while unreset_bleds:
        reset(unreset_bleds.pop())

    ready_bleds = []
コード例 #3
0
"""If there are two bled112 dongles on this computer attempt to setup a loopback test

We will serve a virtual device over one bled112 and connect to it with the other bled112
"""

from __future__ import unicode_literals, absolute_import, print_function
import pytest
import unittest
import subprocess
from iotile_transport_bled112.bled112 import BLED112Adapter
from iotile.core.hw.hwmanager import HardwareManager
import time
import signal

can_loopback = len(BLED112Adapter.find_bled112_devices()) >= 2


@pytest.mark.skipif(
    True,
    reason=
    '(loopback not finished yet)You need two BLED112 adapters for loopback tests'
)
class TestBLED112Loopback(unittest.TestCase):
    def setUp(self):
        self.vdev = subprocess.Popen(
            ['virtual_device', 'bled112', 'report_test'])

        bleds = BLED112Adapter.find_bled112_devices()
        print(bleds)
        self.hw = HardwareManager(port='bled112:{}'.format(bleds[1]))