Skip to content

Commit

Permalink
Version 0.12.0
Browse files Browse the repository at this point in the history
Closes #61.
Closes #58
  • Loading branch information
hbldh committed Nov 1, 2019
2 parents c7fb656 + b68bf94 commit a9eedb5
Show file tree
Hide file tree
Showing 13 changed files with 102 additions and 98 deletions.
50 changes: 0 additions & 50 deletions .travis.yml

This file was deleted.

13 changes: 13 additions & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,19 @@
History
=======

v0.12.0 (2019-11-01)
-----------------------

- Using ``metawear`` version ``0.7.0``


v0.11.1 (2019-10-08)
-----------------------

- Fixes #57
- Merges #54.
- Added first draft of Azure Pipelines CI building.

v0.11.0 (2018-08-08)
--------------------
- Using ``metawear`` version ``0.5.0``
Expand Down
9 changes: 2 additions & 7 deletions Pipfile
Original file line number Diff line number Diff line change
@@ -1,20 +1,15 @@
[[source]]

url = "https://pypi.python.org/simple"
verify_ssl = true
name = "pypi"


[packages]

metawear = "==0.5.0"
metawear = "==0.7.0"
tqdm = "*"


[dev-packages]

pytest = "*"
sphinx = "*"
sphinx-rtd-theme = "*"
pylint = "*"
"flake8" = "*"
"flake8" = "*"
4 changes: 2 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
PyMetaWear
==========

.. image:: https://travis-ci.org/hbldh/pymetawear.svg?branch=master
:target: https://travis-ci.org/hbldh/pymetawear
.. image:: https://dev.azure.com/hbldh/github/_apis/build/status/hbldh.pymetawear?branchName=master
:target: https://dev.azure.com/hbldh/github/_build/latest?definitionId=1?branchName=master

.. image:: https://coveralls.io/repos/github/hbldh/pymetawear/badge.svg?branch=master
:target: https://coveralls.io/github/hbldh/pymetawear?branch=master
Expand Down
67 changes: 53 additions & 14 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,38 +3,48 @@
# Add steps that analyze code, save the dist with the build record, publish to a PyPI-compatible index, and more:
# https://docs.microsoft.com/azure/devops/pipelines/languages/python

trigger:
- master
- releases/*
- develop
- feature/*

jobs:

- job: 'Test'
- job: 'TestLinux'
pool:
vmImage: 'Ubuntu 16.04'
strategy:
matrix:
Python27:
Python27-x64:
python.version: '2.7'
Python35:
python.architecture: 'x64'
Python35-x64:
python.version: '3.5'
Python36:
python.architecture: 'x64'
Python36-x64:
python.version: '3.6'
Python37:
python.architecture: 'x64'
Python37-x64:
python.version: '3.7'
python.architecture: 'x64'
maxParallel: 4

steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '$(python.version)'
architecture: 'x64'
architecture: '$(python.architecture)'

- script: apt install cmake build-essential libglib2.0-dev bluez bluetooth python-dev python3-dev libbluetooth-dev libboost-python-dev libboost-thread-dev
- script: sudo apt install cmake build-essential libglib2.0-dev bluez bluetooth python-dev python3-dev libbluetooth-dev libboost-python-dev libboost-thread-dev
displayName: 'Install system dependencies'

- script: python -m pip install --upgrade pip && pip install -r requirements.txt
displayName: 'Install Python dependencies'

- script: |
pip install pytest
pytest tests --doctest-modules --junitxml=junit/test-results.xml
pip install pytest pytest-cov mock
pytest tests --doctest-modules --junitxml=junit/test-results.xml --cov pymetawear --cov-report term-missing
displayName: 'pytest'
- task: PublishTestResults@2
Expand All @@ -44,15 +54,44 @@ jobs:
condition: succeededOrFailed()

- job: 'Publish'
dependsOn: 'Test'
dependsOn: 'TestLinux'
pool:
vmImage: 'Ubuntu 16.04'

strategy:
matrix:
Python27-x64:
python.version: '2.7'
python.architecture: 'x64'
Python35-x64:
python.version: '3.5'
python.architecture: 'x64'
Python36-x64:
python.version: '3.6'
python.architecture: 'x64'
Python37-x64:
python.version: '3.7'
python.architecture: 'x64'
maxParallel: 4

steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '3.x'
architecture: 'x64'
versionSpec: '$(python.version)'
architecture: '$(python.architecture)'

- script: sudo apt install cmake build-essential libglib2.0-dev bluez bluetooth python-dev python3-dev libbluetooth-dev libboost-python-dev libboost-thread-dev
displayName: 'Install system dependencies'

- script: python -m pip install --upgrade pip && pip install -U setuptools wheel
displayName: 'Install Python dependencies'

- script: python setup.py sdist bdist_wheel
displayName: 'Build sdist and bdist_wheel'

- task: PublishBuildArtifacts@1
displayName: 'Publish Artifact: dist'
inputs:
PathtoPublish: dist
ArtifactName: 'dist-$(python.version)-$(python.architecture)'

- script: python setup.py sdist
displayName: 'Build sdist'
4 changes: 2 additions & 2 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
PyMetaWear documentation
========================

.. image:: https://travis-ci.org/hbldh/pymetawear.svg?branch=master
:target: https://travis-ci.org/hbldh/pymetawear
.. image:: https://dev.azure.com/hbldh/github/_apis/build/status/hbldh.pymetawear?branchName=master
:target: https://dev.azure.com/hbldh/github/_build/latest?definitionId=1?branchName=master

.. image:: https://coveralls.io/repos/github/hbldh/pymetawear/badge.svg?branch=master
:target: https://coveralls.io/github/hbldh/pymetawear?branch=master
Expand Down
4 changes: 2 additions & 2 deletions examples/magnetometer_logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
print(k, v)

print("Write magnetometer settings...")
client.magnetometer.set_settings(power_preset='REGULAR')
client.magnetometer.set_settings(power_preset='REGULAR', odr='30')

# Not implemented yet...
# settings = client.magnetometer.get_current_settings()
Expand All @@ -40,7 +40,7 @@
client.magnetometer.start_logging()
print("Logging magnetometer data...")

time.sleep(3.0)
time.sleep(5.0)

client.magnetometer.stop_logging()
print("Logging stopped.")
Expand Down
4 changes: 2 additions & 2 deletions examples/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
#time.sleep(2.0)

print("Set new device name...")
c.settings.set_device_name(name="Antiware")
c.settings.set_device_name(name="hbldh")

time.sleep(2.0)

Expand All @@ -40,7 +40,7 @@

time.sleep(2.0)

scan_response= "\x03\x03\xD8\xfe\x10\x16\xd8\xfe\x00\x12\x00\x6d\x62\x69\x65\x6e\x74\x6c\x61\x62\x00"
scan_response = "\x03\x03\xD8\xfe\x10\x16\xd8\xfe\x00\x12\x00\x6d\x62\x69\x65\x6e\x74\x6c\x61\x62\x00"
print("Set custom scan response...")
c.settings.set_scan_response(response=scan_response)

Expand Down
12 changes: 12 additions & 0 deletions pymetawear/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ def __init__(self, address, device='hci0', connect=True, debug=False):
"""Constructor."""
self._address = address
self._debug = debug
self._connect = connect

if self._debug:
add_stream_logger()
Expand All @@ -86,6 +87,17 @@ def __init__(self, address, device='hci0', connect=True, debug=False):
if connect:
self.connect()

def __enter__(self):
if not self._connect:
self.connect()
return self

def __exit__(self, exc_type, exc_val, exc_tb):
try:
self.disconnect()
except Exception as e:
print("Could not disconnect: {0}".format(e))

@property
def board(self):
return self.mw.board
Expand Down
18 changes: 11 additions & 7 deletions pymetawear/modules/magnetometer.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ class MagnetometerModule(PyMetaWearLoggingModule):

def __init__(self, board, module_id):
super(MagnetometerModule, self).__init__(board)
self.current_power_preset = None

self.module_id = module_id

self.power_presets = {}
Expand Down Expand Up @@ -104,17 +106,18 @@ def _get_power_preset(self, value):

@require_bmm150
def get_current_settings(self):
raise NotImplementedError()
return {
'power_preset': self.current_power_preset
}

@require_bmm150
def get_possible_settings(self):
return {
'power_preset': [sorted(self.power_presets.keys(), key=lambda x:(x.lower()))],
'odr': [sorted(self.odr.keys(), key=lambda x:(x.lower()))]
}

@require_bmm150
def set_settings(self, power_preset):
def set_settings(self, power_preset=None):
"""Set magnetometer settings.
.code-block:: python
Expand All @@ -128,10 +131,11 @@ def set_settings(self, power_preset):
accuracy and power consumption
"""
# TODO: Add setting of ODR.
pp = self._get_power_preset(power_preset)
log.debug("Setting Magnetometer power preset to {0}".format(pp))
libmetawear.mbl_mw_mag_bmm150_set_preset(self.board, pp)
if power_preset is not None:
pp = self._get_power_preset(power_preset)
log.debug("Setting Magnetometer power preset to {0}".format(pp))
libmetawear.mbl_mw_mag_bmm150_set_preset(self.board, pp)
self.current_power_preset = pp

@require_bmm150
def notifications(self, callback=None):
Expand Down
11 changes: 1 addition & 10 deletions pymetawear/version.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,9 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
version.py
-----------
Release data for the PyMetaWear project.
:copyright: 2016-11-28 by hbldh <henrik.blidh@nedomkull.com>
"""

from __future__ import division
from __future__ import print_function
from __future__ import absolute_import

__version__ = '0.11.1'
__version__ = '0.12.0'
version = __version__ # backwards compatibility name
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
metawear==0.5.0
metawear==0.7.0
tqdm
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

# What packages are required for this module to be executed?
REQUIRED = [
'metawear==0.5.0',
'metawear==0.7.0',
'tqdm',
]

Expand Down

0 comments on commit a9eedb5

Please sign in to comment.