コード例 #1
0
class UARTIntegrationTest(BaseIntegrationTest):
    setupHasAlreadyRun = False
    comPort = None

    def setUp(self):
        if not self.comPort:
            raise unittest.SkipTest("No COM port specified.")

        # Give it a break between each test
        time.sleep(1)

        if not self.setupHasAlreadyRun:
            self.api = NeblinaAPI(Interface.UART)
            self.api.open(self.comPort)
            if not self.api.isOpened():
                self.fail("Unable to connect to COM port.")
            self.api.streamDisableAll()
            self.api.sessionRecord(False)
            self.api.setDataPortState(Interface.UART, True)

    def tearDown(self):
        self.api.streamDisableAll()
        self.api.sessionRecord(False)
        self.api.close()
        pass
コード例 #2
0
def main(address):
    signalKiller = GracefulKiller()

    print("Initialize NeblinaAPI")
    api = NeblinaAPI(Interface.BLE)
    print("Opening device: {0}".format(address))
    api.open(address)
    if not api.isOpened():
        exit("Unable to connect to device.")
    print("Opening BLE streaming port")
    api.setDataPortState(Interface.BLE, True)

    # It is required to downsample streaming rate to 25Hz (40ms delay) or more to ensure
    # reception of all incoming streaming packet and other packet when using BLE on Python.
    api.setDownsample(40)

    print("Starting EulerAngle Streaming")
    api.streamEulerAngle(True)
    while not signalKiller.isKilled:
        print(api.getEulerAngle())
    print("Stopping EulerAngle Streaming")
    api.streamEulerAngle(False)
コード例 #3
0
def main(address):
    signalKiller = GracefulKiller()

    print("Initialize NeblinaAPI")
    api = NeblinaAPI(Interface.BLE)
    print("Opening device: {0}".format(address))
    api.open(address)
    if not api.isOpened():
        exit("Unable to connect to device.")
    print("Opening BLE streaming port")
    api.setDataPortState(Interface.BLE, True)

    # It is required to downsample streaming rate to 25Hz (40ms delay) or more to ensure
    # reception of all incoming streaming packet and other packet when using BLE on Python.
    api.setDownsample(40)

    print("Starting EulerAngle Streaming")
    api.streamEulerAngle(True)
    while not signalKiller.isKilled:
        print(api.getEulerAngle())
    print("Stopping EulerAngle Streaming")
    api.streamEulerAngle(False)
コード例 #4
0
class BLEIntegrationTest(BaseIntegrationTest):
    setupHasAlreadyRun = False
    deviceAddress = None

    def setUp(self):
        if not self.deviceAddress:
            logging.warn("No Device Address specified. Skipping.")
            raise unittest.SkipTest

        # Give it a break between each test
        time.sleep(2)

        self.api = NeblinaAPI(Interface.BLE)
        self.api.open(self.deviceAddress)
        if not self.api.isOpened():
            self.fail("Unable to connect to BLE device.")
        self.api.streamDisableAll()
        self.api.sessionRecord(False)
        self.api.setDataPortState(Interface.BLE, True)

    def tearDown(self):
        self.api.streamDisableAll()
        self.api.sessionRecord(False)
        self.api.close()
コード例 #5
0
class BLEIntegrationTest(BaseIntegrationTest):
    setupHasAlreadyRun = False
    deviceAddress = None

    def setUp(self):
        if not self.deviceAddress:
            logging.warn("No Device Address specified. Skipping.")
            raise unittest.SkipTest

        # Give it a break between each test
        time.sleep(2)

        self.api = NeblinaAPI(Interface.BLE)
        self.api.open(self.deviceAddress)
        if not self.api.isOpened():
            self.fail("Unable to connect to BLE device.")
        self.api.streamDisableAll()
        self.api.sessionRecord(False)
        self.api.setDataPortState(Interface.BLE, True)

    def tearDown(self):
        self.api.streamDisableAll()
        self.api.sessionRecord(False)
        self.api.close()