summaryrefslogtreecommitdiff
path: root/python-pymata.spec
blob: 49447adf4135823ce9193333abe96b453ccd6e42 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
%global _empty_manifest_terminate_build 0
Name:		python-PyMata
Version:	2.20
Release:	1
Summary:	A Python Protocol Abstraction Library For Arduino Firmata
License:	GNU Affero General Public License v3 or later (AGPLv3+)
URL:		https://github.com/MrYsLab/PyMata
Source0:	https://mirrors.nju.edu.cn/pypi/web/packages/de/02/174fceebefe3f74715f44e82a896b11f73ec782f0401eebd4baeb3c491cf/PyMata-2.20.tar.gz
BuildArch:	noarch

Requires:	python3-pyserial

%description
PyMata is a high performance, multi-threaded, non-blocking Python client for the Firmata Protocol that supports
the complete StandardFirmata protocol.
A new version for Python 3.5, pymata_aio, can be found [here](https://github.com/MrYsLab/pymata-aio).
The API can be viewed on the [wiki](https://github.com/MrYsLab/PyMata/wiki).
## Major features
* __Implements the entire Firmata 2.4.1 protocol.__
* __Python 2.7+ and Python 3.4+__ compatibility through a shared code set. (If you are running Python 3.4 on Linux, please see note below).
* Easy to use and intuitive __API__. You can view the [PyMata API Documentation here](https://htmlpreview.github.io/?https://raw.githubusercontent.com/MrYsLab/PyMata/master/documentation/html/pymata.m.html) or view in the Documentation/html directory.
* Custom support for __stepper motors, Sonar Ping Devices (HC-SR04), Piezo devices and Rotary Encoders__.
  * Requires the use of FirmataPlus for PyMata - installation instructions may be found [here](https://github.com/MrYsLab/PyMata/wiki/Installing-FirmataPlus).
* __Wiring diagrams__ are provided for all examples in the examples directory.
* Digial and Analog __Transient Signal Monitoring Via Data Latches:__
  * They provide "one-shot" notification when either a digital or analog pin meets a user defined threshold.
  * Analog latches compare each data change to a user specified value.
    * Comparison operators are <, >, <= and >=
  * Digital latches compare a data change to either a high or low, specified by the user.
  * Latches can easily be re-armed to detect the next transient data change.
  * Latches can be either manually read or a callback can be associated with a latch for immediate notification.
* Optional __callbacks__ provide asynchronous notification of data updates.
## Callbacks
Check out the example code on the [wiki](https://github.com/MrYsLab/PyMata/wiki).
  * Digital input pins.
  * Analog input pins.
  * Encoder changes.
  * I2C read data changes.
  * SONAR (HC-SR04) distance changes.
  * Analog latch condition achieved.
  * Digital latch condition achieved.
  * Callbacks return data reports in a single list format.
  * Polling methods and callbacks are available simultaneously and can be used in a mixed polled/callback environment.
  * Callbacks return data in a single list.
### The callback data return values
| Callback Type | List Element 0 | List Element 1 | List Element 2 | List Element 3 |
| ------------- | -------------- | -------------- | -------------- | -------------- |
| Analog| ANALOG MODE|Pin Number|Data Value|Not Applicable
| Digital|DIGITAL MODE|Pin Number|Data Value|Not Applicable
|I2C|I2C MODE|I2C Device Address|Data Value|Not Applicable
|Sonar|Trigger Pin|Distance in Centimeters|Not Applicable|Not Applicatble
| Encoder|Encoder MODE|Pin Number|Data Value|Not Applicable
| Latched Analog| LATCHED ANALOG MODE|Pin Number|Data Value|Time Stamp
| Latched Digital|LATCHED DIGITAL MODE|Pin Number|Data Value|Time Stamp
## Control-C Signal Handler
Below is a sample Control-C signal handler that can be added to a PyMata Application.
It suppresses exceptions being reported as a result of the user entering a Control-C to abort the application.
```python
import sys
import signal
# followed by another imports your application requires
# create a PyMata instance
# set the COM port string specifically for your platform
board = PyMata("/dev/ttyACM0")
# signal handler function called when Control-C occurs
def signal_handler(signal, frame):
    print('You pressed Ctrl+C!!!!')
    if board != None:
        board.reset()
    sys.exit(0)
# listen for SIGINT
signal.signal(signal.SIGINT, signal_handler)
# Your Application Continues Below This Point
```
## Misc
- Want to extend PyMata? See [Our Instructables Article](http://www.instructables.com/id/Going-Beyond-StandardFirmata-Adding-New-Device-Sup/) explaining how stepper motor support was added. Use it as a guide to customize PyMata for your own needs.
- [Check Out Mr. Y's Blog Here](http://mryslab.blogspot.com/) for all the latest news!
# Special Note For Linux Users Wishing to Use Python 3.5
# [pymata_aio is now available and for Python 3.5.](https://github.com/MrYsLab/pymata-aio)
# [Check out the pymata_aio wiki!](https://github.com/MrYsLab/pymata-aio/wiki)
This project was developed with [Pycharm](https://www.jetbrains.com/pycharm/) ![logo](https://github.com/MrYsLab/python_banyan/blob/master/images/icon_PyCharm.png)

%package -n python3-PyMata
Summary:	A Python Protocol Abstraction Library For Arduino Firmata
Provides:	python-PyMata
BuildRequires:	python3-devel
BuildRequires:	python3-setuptools
BuildRequires:	python3-pip
%description -n python3-PyMata
PyMata is a high performance, multi-threaded, non-blocking Python client for the Firmata Protocol that supports
the complete StandardFirmata protocol.
A new version for Python 3.5, pymata_aio, can be found [here](https://github.com/MrYsLab/pymata-aio).
The API can be viewed on the [wiki](https://github.com/MrYsLab/PyMata/wiki).
## Major features
* __Implements the entire Firmata 2.4.1 protocol.__
* __Python 2.7+ and Python 3.4+__ compatibility through a shared code set. (If you are running Python 3.4 on Linux, please see note below).
* Easy to use and intuitive __API__. You can view the [PyMata API Documentation here](https://htmlpreview.github.io/?https://raw.githubusercontent.com/MrYsLab/PyMata/master/documentation/html/pymata.m.html) or view in the Documentation/html directory.
* Custom support for __stepper motors, Sonar Ping Devices (HC-SR04), Piezo devices and Rotary Encoders__.
  * Requires the use of FirmataPlus for PyMata - installation instructions may be found [here](https://github.com/MrYsLab/PyMata/wiki/Installing-FirmataPlus).
* __Wiring diagrams__ are provided for all examples in the examples directory.
* Digial and Analog __Transient Signal Monitoring Via Data Latches:__
  * They provide "one-shot" notification when either a digital or analog pin meets a user defined threshold.
  * Analog latches compare each data change to a user specified value.
    * Comparison operators are <, >, <= and >=
  * Digital latches compare a data change to either a high or low, specified by the user.
  * Latches can easily be re-armed to detect the next transient data change.
  * Latches can be either manually read or a callback can be associated with a latch for immediate notification.
* Optional __callbacks__ provide asynchronous notification of data updates.
## Callbacks
Check out the example code on the [wiki](https://github.com/MrYsLab/PyMata/wiki).
  * Digital input pins.
  * Analog input pins.
  * Encoder changes.
  * I2C read data changes.
  * SONAR (HC-SR04) distance changes.
  * Analog latch condition achieved.
  * Digital latch condition achieved.
  * Callbacks return data reports in a single list format.
  * Polling methods and callbacks are available simultaneously and can be used in a mixed polled/callback environment.
  * Callbacks return data in a single list.
### The callback data return values
| Callback Type | List Element 0 | List Element 1 | List Element 2 | List Element 3 |
| ------------- | -------------- | -------------- | -------------- | -------------- |
| Analog| ANALOG MODE|Pin Number|Data Value|Not Applicable
| Digital|DIGITAL MODE|Pin Number|Data Value|Not Applicable
|I2C|I2C MODE|I2C Device Address|Data Value|Not Applicable
|Sonar|Trigger Pin|Distance in Centimeters|Not Applicable|Not Applicatble
| Encoder|Encoder MODE|Pin Number|Data Value|Not Applicable
| Latched Analog| LATCHED ANALOG MODE|Pin Number|Data Value|Time Stamp
| Latched Digital|LATCHED DIGITAL MODE|Pin Number|Data Value|Time Stamp
## Control-C Signal Handler
Below is a sample Control-C signal handler that can be added to a PyMata Application.
It suppresses exceptions being reported as a result of the user entering a Control-C to abort the application.
```python
import sys
import signal
# followed by another imports your application requires
# create a PyMata instance
# set the COM port string specifically for your platform
board = PyMata("/dev/ttyACM0")
# signal handler function called when Control-C occurs
def signal_handler(signal, frame):
    print('You pressed Ctrl+C!!!!')
    if board != None:
        board.reset()
    sys.exit(0)
# listen for SIGINT
signal.signal(signal.SIGINT, signal_handler)
# Your Application Continues Below This Point
```
## Misc
- Want to extend PyMata? See [Our Instructables Article](http://www.instructables.com/id/Going-Beyond-StandardFirmata-Adding-New-Device-Sup/) explaining how stepper motor support was added. Use it as a guide to customize PyMata for your own needs.
- [Check Out Mr. Y's Blog Here](http://mryslab.blogspot.com/) for all the latest news!
# Special Note For Linux Users Wishing to Use Python 3.5
# [pymata_aio is now available and for Python 3.5.](https://github.com/MrYsLab/pymata-aio)
# [Check out the pymata_aio wiki!](https://github.com/MrYsLab/pymata-aio/wiki)
This project was developed with [Pycharm](https://www.jetbrains.com/pycharm/) ![logo](https://github.com/MrYsLab/python_banyan/blob/master/images/icon_PyCharm.png)

%package help
Summary:	Development documents and examples for PyMata
Provides:	python3-PyMata-doc
%description help
PyMata is a high performance, multi-threaded, non-blocking Python client for the Firmata Protocol that supports
the complete StandardFirmata protocol.
A new version for Python 3.5, pymata_aio, can be found [here](https://github.com/MrYsLab/pymata-aio).
The API can be viewed on the [wiki](https://github.com/MrYsLab/PyMata/wiki).
## Major features
* __Implements the entire Firmata 2.4.1 protocol.__
* __Python 2.7+ and Python 3.4+__ compatibility through a shared code set. (If you are running Python 3.4 on Linux, please see note below).
* Easy to use and intuitive __API__. You can view the [PyMata API Documentation here](https://htmlpreview.github.io/?https://raw.githubusercontent.com/MrYsLab/PyMata/master/documentation/html/pymata.m.html) or view in the Documentation/html directory.
* Custom support for __stepper motors, Sonar Ping Devices (HC-SR04), Piezo devices and Rotary Encoders__.
  * Requires the use of FirmataPlus for PyMata - installation instructions may be found [here](https://github.com/MrYsLab/PyMata/wiki/Installing-FirmataPlus).
* __Wiring diagrams__ are provided for all examples in the examples directory.
* Digial and Analog __Transient Signal Monitoring Via Data Latches:__
  * They provide "one-shot" notification when either a digital or analog pin meets a user defined threshold.
  * Analog latches compare each data change to a user specified value.
    * Comparison operators are <, >, <= and >=
  * Digital latches compare a data change to either a high or low, specified by the user.
  * Latches can easily be re-armed to detect the next transient data change.
  * Latches can be either manually read or a callback can be associated with a latch for immediate notification.
* Optional __callbacks__ provide asynchronous notification of data updates.
## Callbacks
Check out the example code on the [wiki](https://github.com/MrYsLab/PyMata/wiki).
  * Digital input pins.
  * Analog input pins.
  * Encoder changes.
  * I2C read data changes.
  * SONAR (HC-SR04) distance changes.
  * Analog latch condition achieved.
  * Digital latch condition achieved.
  * Callbacks return data reports in a single list format.
  * Polling methods and callbacks are available simultaneously and can be used in a mixed polled/callback environment.
  * Callbacks return data in a single list.
### The callback data return values
| Callback Type | List Element 0 | List Element 1 | List Element 2 | List Element 3 |
| ------------- | -------------- | -------------- | -------------- | -------------- |
| Analog| ANALOG MODE|Pin Number|Data Value|Not Applicable
| Digital|DIGITAL MODE|Pin Number|Data Value|Not Applicable
|I2C|I2C MODE|I2C Device Address|Data Value|Not Applicable
|Sonar|Trigger Pin|Distance in Centimeters|Not Applicable|Not Applicatble
| Encoder|Encoder MODE|Pin Number|Data Value|Not Applicable
| Latched Analog| LATCHED ANALOG MODE|Pin Number|Data Value|Time Stamp
| Latched Digital|LATCHED DIGITAL MODE|Pin Number|Data Value|Time Stamp
## Control-C Signal Handler
Below is a sample Control-C signal handler that can be added to a PyMata Application.
It suppresses exceptions being reported as a result of the user entering a Control-C to abort the application.
```python
import sys
import signal
# followed by another imports your application requires
# create a PyMata instance
# set the COM port string specifically for your platform
board = PyMata("/dev/ttyACM0")
# signal handler function called when Control-C occurs
def signal_handler(signal, frame):
    print('You pressed Ctrl+C!!!!')
    if board != None:
        board.reset()
    sys.exit(0)
# listen for SIGINT
signal.signal(signal.SIGINT, signal_handler)
# Your Application Continues Below This Point
```
## Misc
- Want to extend PyMata? See [Our Instructables Article](http://www.instructables.com/id/Going-Beyond-StandardFirmata-Adding-New-Device-Sup/) explaining how stepper motor support was added. Use it as a guide to customize PyMata for your own needs.
- [Check Out Mr. Y's Blog Here](http://mryslab.blogspot.com/) for all the latest news!
# Special Note For Linux Users Wishing to Use Python 3.5
# [pymata_aio is now available and for Python 3.5.](https://github.com/MrYsLab/pymata-aio)
# [Check out the pymata_aio wiki!](https://github.com/MrYsLab/pymata-aio/wiki)
This project was developed with [Pycharm](https://www.jetbrains.com/pycharm/) ![logo](https://github.com/MrYsLab/python_banyan/blob/master/images/icon_PyCharm.png)

%prep
%autosetup -n PyMata-2.20

%build
%py3_build

%install
%py3_install
install -d -m755 %{buildroot}/%{_pkgdocdir}
if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi
if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi
if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi
if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi
pushd %{buildroot}
if [ -d usr/lib ]; then
	find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst
fi
if [ -d usr/lib64 ]; then
	find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst
fi
if [ -d usr/bin ]; then
	find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst
fi
if [ -d usr/sbin ]; then
	find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst
fi
touch doclist.lst
if [ -d usr/share/man ]; then
	find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst
fi
popd
mv %{buildroot}/filelist.lst .
mv %{buildroot}/doclist.lst .

%files -n python3-PyMata -f filelist.lst
%dir %{python3_sitelib}/*

%files help -f doclist.lst
%{_docdir}/*

%changelog
* Fri May 05 2023 Python_Bot <Python_Bot@openeuler.org> - 2.20-1
- Package Spec generated