Skip to content

Commit cc9d28d

Browse files
author
Sergio Chica
committed
Ranamed update_callback -> set_callback. Added unset_callback. Splitted requirements into gui_requirements.
1 parent 9542908 commit cc9d28d

File tree

5 files changed

+24
-10
lines changed

5 files changed

+24
-10
lines changed

README.md

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Description
2-
Python3 library to read data from Neurosky Mindwave Mobile 2 in linux using
3-
bluetooth.
2+
Python3 library to read data from Neurosky Mindwave Mobile 2 on linux using
3+
pybluez2.
44

55
**Contents:**
66
- [Requirements](#requirements)
@@ -29,6 +29,7 @@ $ python -m pip install neuropy3[gui] # to install gui dependencies
2929
or manually
3030
```bash
3131
$ python -m pip install -r requirements.txt
32+
$ python -m pip install -r gui_requirements.txt # to install gui dependencies
3233
```
3334

3435
# Execution
@@ -62,10 +63,12 @@ $ python -m neuropy3 --address XX:YY:ZZ:AA:BB:CC --gui
6263
>>> from neuropy3.neuropy3 import MindWave
6364
>>> mw = MindWave(address='XX:YY:ZZ:AA:BB:CC', autostart=False, verbose=3)
6465
>>> # mw = MindWave(autostart=False, verbose=3) # Autoscan for MindWave Mobile
65-
>>> mw.update_callback('eeg', lambda x: print(x))
66-
>>> mw.update_callback('meditation', lambda x: print(x))
67-
>>> mw.update_callback('attention', lambda x: print(x))
66+
>>> mw.set_callback('eeg', lambda x: print(x))
67+
>>> mw.set_callback('meditation', lambda x: print(x))
68+
>>> mw.set_callback('attention', lambda x: print(x))
6869
>>> mw.start()
70+
>>> mw.unset_callback('eeg')
71+
>>> mw.stop()
6972
```
7073

7174
# Acknowledgements

gui_requirements.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
numpy==1.23.3
2+
pybluez2==0.46
3+
PySide6==6.2.3
4+
scipy==1.9.1
5+
shiboken6==6.2.3

neuropy3/neuropy3.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ def stop(self):
307307
self.socket.close()
308308
self.socket = None
309309

310-
def update_callback(self, target, callback):
310+
def set_callback(self, target, callback):
311311
"""Define callback function for a given target
312312
Executes a function when a value is updated
313313
@@ -318,6 +318,14 @@ def update_callback(self, target, callback):
318318
:type callback: function"""
319319
self.callbacks[target] = callback
320320

321+
def unset_callback(self, target):
322+
"""Remove callback for a given target
323+
324+
:param target: The value to be untracked
325+
:type target: str"""
326+
if target in self.callbacks:
327+
del self.callbacks[target]
328+
321329
def received(self):
322330
"""Total packets received (and valid)"""
323331
return self.data['packets']

requirements.txt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
pybluez2==0.46
21
numpy==1.23.3
3-
PySide6==6.2.3
2+
pybluez2==0.46
43
scipy==1.9.1
5-
shiboken6==6.2.3

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131

3232
setup(
3333
name='neuropy3',
34-
version='1.0.3',
34+
version='1.0.4',
3535
description=('Python3 library to read data from '
3636
'Neurosky Mindwave Mobile 2 in linux.'),
3737
author='Sergio Chica',

0 commit comments

Comments
 (0)