Beispiel #1
0
    def test_chain_setup(self):
        self.expected_cmds = [[0x09, 0x02, 0x01, 0x01, 0xff, 0x00, 0x02, 0x10],
                              [
                                  0x09, 0x02, 0x09, 0x03, 0x00, 0x00, 0x09,
                                  0x03, 0x04, 0x02, 0x00, 0x00, 0x00, 0x00
                              ],
                              [
                                  0x09, 0x02, 0x09, 0x03, 0x01, 0x60, 0x06,
                                  0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00
                              ],
                              [
                                  0x09, 0x02, 0x09, 0x03, 0x01, 0x60, 0x06,
                                  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
                              ],
                              [0x0a, 0x02, 0x09, 0x03, 0x02, 0x02, 0x03, 0x0f],
                              [
                                  0x0a, 0x03, 0x02, 0x02, 0x10, 0x10, 0x00,
                                  0x00, 0xf4, 0x01, 0x00, 0x00, 0xe8, 0x03,
                                  0x00, 0x00, 0xff
                              ],
                              [0x0a, 0x02, 0x09, 0x03, 0x02, 0x02, 0x01, 0x01],
                              [0x0a, 0x03, 0x01],
                              [0x0a, 0x02, 0x09, 0x03, 0x03, 0x02, 0x02, 0x01],
                              [0x0a, 0x03, 0x01]]

        self.cmds_recorded_handler = FnVoid(self.cmds_recorded)
        self.counter_handler = FnVoidPtr(self.counter_processor_created)
        self.math_handler = FnVoidPtr(self.math_processor_created)

        switch_signal = self.libmetawear.mbl_mw_switch_get_state_data_signal(
            self.board)
        self.libmetawear.mbl_mw_dataprocessor_counter_create(
            switch_signal, self.counter_handler)
Beispiel #2
0
 def math_processor_created(self, signal):
     self.abs_ref_offset = signal
     self.gt_comparator_handler = FnVoidPtr(
         self.gt_comparator_processor_created)
     self.libmetawear.mbl_mw_dataprocessor_comparator_create(
         signal, Comparator.OPERATION_GT, c_float(0),
         self.gt_comparator_handler)
Beispiel #3
0
 def gt_counter_comparator_processor_created(self, signal):
     self.gt_comparator_counter_comparator = signal
     self.lte_comparator_handler = FnVoidPtr(
         self.lte_comparator_processor_created)
     self.libmetawear.mbl_mw_dataprocessor_comparator_create(
         self.abs_ref_offset, Comparator.OPERATION_LTE, c_float(0),
         self.lte_comparator_handler)
Beispiel #4
0
 def lte_counter_processor_created(self, signal):
     self.lte_comparator_counter = signal
     self.lte_counter_comparator_handler = FnVoidPtr(
         self.lte_counter_comparator_processor_created)
     self.libmetawear.mbl_mw_dataprocessor_comparator_create(
         signal, Comparator.OPERATION_EQ, c_float(16),
         self.lte_counter_comparator_handler)
Beispiel #5
0
    def comparator_odd_created(self, signal):
        self.comp_odd_signal = signal

        self.comparator_even_handler = FnVoidPtr(self.comparator_even_created)
        self.libmetawear.mbl_mw_dataprocessor_comparator_create(
            self.modulus_signal, Comparator.OPERATION_EQ, c_float(0),
            self.comparator_even_handler)
Beispiel #6
0
    def setUp(self):
        self.boardType = TestMetaWearBase.METAWEAR_RPRO_BOARD

        super().setUp()

        self.processor_handler = FnVoidPtr(self.processor_created)
        self.baro_pa_signal = self.libmetawear.mbl_mw_baro_bmp280_get_pressure_data_signal(
            self.board)
Beispiel #7
0
    def threshold_processor_created(self, signal):
        self.threshold_signal = signal

        self.comparator_below_handler = FnVoidPtr(
            self.comparator_below_created)
        self.libmetawear.mbl_mw_dataprocessor_comparator_create(
            signal, Comparator.OPERATION_EQ, c_float(-1),
            self.comparator_below_handler)
Beispiel #8
0
    def setUp(self):
        super().setUp()

        self.pulse_handler = FnVoidPtr(self.pulse_processor_created)
        gpio_adc_signal = self.libmetawear.mbl_mw_gpio_get_analog_input_data_signal(
            self.board, c_ubyte(0), Gpio.ANALOG_READ_MODE_ADC)
        self.libmetawear.mbl_mw_dataprocessor_pulse_create(
            gpio_adc_signal, Pulse.OUTPUT_PEAK, c_float(500), c_ushort(10),
            self.pulse_handler)
Beispiel #9
0
    def setUp(self):
        super().setUp()

        self.passthrough_handler = FnVoidPtr(
            self.passthrough_processor_created)
        self.gpio_abs_ref_signal = self.libmetawear.mbl_mw_gpio_get_analog_input_data_signal(
            self.board, c_ubyte(0), Gpio.ANALOG_READ_MODE_ABS_REF)
        self.libmetawear.mbl_mw_dataprocessor_passthrough_create(
            self.gpio_abs_ref_signal, Passthrough.MODE_COUNT, c_ushort(0),
            self.passthrough_handler)
Beispiel #10
0
    def setUp(self):
        self.boardType = TestMetaWearBase.METAWEAR_RPRO_BOARD

        super().setUp()

        self.rms_handler = FnVoidPtr(self.rms_processor_created)
        accel_signal = self.libmetawear.mbl_mw_acc_get_acceleration_data_signal(
            self.board)
        self.libmetawear.mbl_mw_dataprocessor_rms_create(
            accel_signal, self.rms_handler)
Beispiel #11
0
    def test_collector_setup(self):
        self.expected_cmds = [[
            0x09, 0x02, 0x05, 0x87, 0x00, 0x20, 0x0a, 0x01, 0x10
        ], [0x09, 0x02, 0x09, 0x03, 0x00, 0x20, 0x01, 0x02, 0x00, 0x00]]

        self.sample_handler = FnVoidPtr(self.sample_processor_created)
        gpio_adc_signal = self.libmetawear.mbl_mw_gpio_get_analog_input_data_signal(
            self.board, c_ubyte(0), Gpio.ANALOG_READ_MODE_ADC)
        self.libmetawear.mbl_mw_dataprocessor_sample_create(
            gpio_adc_signal, c_ubyte(16), self.sample_handler)
Beispiel #12
0
    def setUp(self):
        self.boardType = TestMetaWearBase.METAWEAR_RPRO_BOARD

        super().setUp()

        self.f_mult_handler = FnVoidPtr(self.f_mult_processor_created)
        self.temp_signal = self.libmetawear.mbl_mw_multi_chnl_temp_get_temperature_data_signal(
            self.board,
            c_ubyte(MultiChannelTemperature.METAWEAR_RPRO_CHANNEL_ON_DIE))
        self.libmetawear.mbl_mw_dataprocessor_math_create(
            self.temp_signal, Math.OPERATION_MULTIPLY, c_float(18),
            self.f_mult_handler)
Beispiel #13
0
    def test_freefall_setup(self):
        self.expected_cmds = [
            [0x09, 0x02, 0x03, 0x04, 0xff, 0xa0, 0x07, 0xa5, 0x01],
            [0x09, 0x02, 0x09, 0x03, 0x00, 0x20, 0x03, 0x05, 0x04],
            [
                0x09, 0x02, 0x09, 0x03, 0x01, 0x20, 0x0d, 0x09, 0x00, 0x20,
                0x00, 0x00, 0x00, 0x00
            ],
            [
                0x09, 0x02, 0x09, 0x03, 0x02, 0x00, 0x06, 0x01, 0x00, 0x00,
                0xff, 0xff, 0xff, 0xff
            ],
            [
                0x09, 0x02, 0x09, 0x03, 0x02, 0x00, 0x06, 0x01, 0x00, 0x00,
                0x01, 0x00, 0x00, 0x00
            ]
        ]

        self.rss_handler = FnVoidPtr(self.rss_processor_created)
        accel_signal = self.libmetawear.mbl_mw_acc_get_acceleration_data_signal(
            self.board)
        self.libmetawear.mbl_mw_dataprocessor_rss_create(
            accel_signal, self.rss_handler)
Beispiel #14
0
 def rss_processor_created(self, signal):
     self.avg_handler = FnVoidPtr(self.average_processor_created)
     self.libmetawear.mbl_mw_dataprocessor_average_create(
         signal, 4, self.avg_handler)
Beispiel #15
0
 def accum_processor_created(self, signal):
     self.accum_signal = signal
     self.buffer_handler = FnVoidPtr(self.buffer_processor_created)
     self.libmetawear.mbl_mw_dataprocessor_buffer_create(
         signal, self.buffer_handler)
Beispiel #16
0
 def rms_processor_created(self, signal):
     self.accum_handler = FnVoidPtr(self.accum_processor_created)
     self.libmetawear.mbl_mw_dataprocessor_accumulator_create_size(
         signal, c_ubyte(4), self.accum_handler)
Beispiel #17
0
 def time_processor_created(self, signal):
     self.time_signal = signal
     self.delta_handler = FnVoidPtr(self.delta_processor_created)
     self.libmetawear.mbl_mw_dataprocessor_delta_create(
         signal, Delta.MODE_DIFFERENTIAL, c_float(180000),
         self.delta_handler)
Beispiel #18
0
 def buffer_processor_created(self, signal):
     self.time_handler = FnVoidPtr(self.time_processor_created)
     self.libmetawear.mbl_mw_dataprocessor_time_create(
         self.accum_signal, Time.MODE_ABSOLUTE, 30000, self.time_handler)
Beispiel #19
0
 def f_mult_processor_created(self, signal):
     self.f_divide_handler = FnVoidPtr(self.f_divide_processor_created)
     self.libmetawear.mbl_mw_dataprocessor_math_create(
         signal, Math.OPERATION_DIVIDE, c_float(10), self.f_divide_handler)
Beispiel #20
0
 def lte_comparator_processor_created(self, signal):
     self.lte_comparator = signal
     self.lte_counter_handler = FnVoidPtr(
         self.lte_counter_processor_created)
     self.libmetawear.mbl_mw_dataprocessor_counter_create(
         signal, self.lte_counter_handler)
Beispiel #21
0
 def f_divide_processor_created(self, signal):
     self.f_add_handler = FnVoidPtr(self.f_add_processor_created)
     self.libmetawear.mbl_mw_dataprocessor_math_create(
         signal, Math.OPERATION_ADD, c_float(32), self.f_add_handler)
Beispiel #22
0
 def passthrough_processor_created(self, signal):
     self.offset_passthrough = signal
     self.math_handler = FnVoidPtr(self.math_processor_created)
     self.libmetawear.mbl_mw_dataprocessor_math_create(
         self.gpio_abs_ref_signal, Math.OPERATION_SUBTRACT, c_float(0),
         self.math_handler)
Beispiel #23
0
 def f_add_processor_created(self, signal):
     self.fahrenheit_signal = signal
     self.k_add_handler = FnVoidPtr(self.k_add_processor_created)
     self.libmetawear.mbl_mw_dataprocessor_math_create(
         self.temp_signal, Math.OPERATION_ADD, c_float(273.15),
         self.k_add_handler)
Beispiel #24
0
 def average_processor_created(self, signal):
     self.threshold_handler = FnVoidPtr(self.threshold_processor_created)
     self.libmetawear.mbl_mw_dataprocessor_threshold_create(
         signal, Threshold.MODE_BINARY, c_float(0.5), c_float(0),
         self.threshold_handler)
Beispiel #25
0
 def sample_processor_created(self, signal):
     self.passthrough_handler = FnVoidPtr(
         self.passthrough_processor_created)
     self.libmetawear.mbl_mw_dataprocessor_passthrough_create(
         signal, Passthrough.MODE_COUNT, c_ushort(0),
         self.passthrough_handler)