Module interface¶
The base/parent module interface that the actual module implementations inherit from.
Performs the actual notification registration and handling of callbacks, but leaves everything else to the actual module implementations.
API¶
Base module¶
Created by hbldh <henrik.blidh@nedomkull.com> on 2016-04-14 Modified by lkasso <hello@mbientlab.com>
-
class
pymetawear.modules.base.
PyMetaWearLoggingModule
(board)[source]¶ Special class with additions for modules with logging support.
-
download_log
(timeout=3.0, data_callback=None, progress_update_function=None, unknown_entry_function=None, unhandled_entry_function=None)[source]¶ Download logged data from the MetaWear board
Parameters: - timeout – Time to wait for download to resume if connection is lost.
- data_callback – Function called to process each downloaded sample.
- progress_update_function – Function called each progress_update_each_n_sample to give feedback on download progress.
- unknown_entry_function – Function called when unknown logging entries are encountered.
- unhandled_entry_function – Function called when unhandled entries are encountered.
Returns: The logged data, in case download was successful.
-
-
class
pymetawear.modules.base.
PyMetaWearModule
(board)[source]¶ Base class for PyMetaWear module implementations.
Parameters: - board (ctypes.c_long) – The MetaWear board pointer value.
- debug (bool) – If
True
, module prints out debug information.
-
data_signal
¶ Returns the data signal pointer value for the switch module.
Returns: The pointer value. (Long if on x64 architecture.) Return type: ctypes.c_long
orctypes.c_int
-
module_name
¶ Get module name.
Returns: The name of this module. Return type: str
-
notifications
(callback=None)[source]¶ Toggle notifications/subscriptions to data signals on the MetaWear board.
Parameters: callback (callable) – The function to call when data signal notification arrives. If None
, an unsubscription to notifications is sent.
-
sensor_name
¶ Get sensor name, if applicable.
Returns: The name of this module. Return type: str or None
-
pymetawear.modules.base.
context_callback
(func)[source]¶ Decorator to handle the context argument added in MetaWear C++ API 0.12
This method is used internally so that the end-user should not have to know about and handle the
context
argument.Parameters: func – The function to add context argument to. Returns: The wrapped function.