smallneuron 1.1.0__tar.gz → 1.1.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {smallneuron-1.1.0/src/smallneuron.egg-info → smallneuron-1.1.2}/PKG-INFO +2 -2
- {smallneuron-1.1.0 → smallneuron-1.1.2}/README.md +1 -1
- {smallneuron-1.1.0 → smallneuron-1.1.2}/pyproject.toml +1 -1
- {smallneuron-1.1.0 → smallneuron-1.1.2}/src/smallneuron/smallneuron.py +1 -1
- smallneuron-1.1.0/src/smallneuron/snhttp.py → smallneuron-1.1.2/src/smallneuron/snapi.py +9 -12
- {smallneuron-1.1.0 → smallneuron-1.1.2}/src/smallneuron/snserial.py +30 -15
- {smallneuron-1.1.0 → smallneuron-1.1.2/src/smallneuron.egg-info}/PKG-INFO +2 -2
- {smallneuron-1.1.0 → smallneuron-1.1.2}/src/smallneuron.egg-info/SOURCES.txt +1 -1
- {smallneuron-1.1.0 → smallneuron-1.1.2}/.gitignore +0 -0
- {smallneuron-1.1.0 → smallneuron-1.1.2}/LICENSE +0 -0
- {smallneuron-1.1.0 → smallneuron-1.1.2}/example.py +0 -0
- {smallneuron-1.1.0 → smallneuron-1.1.2}/setup.cfg +0 -0
- {smallneuron-1.1.0 → smallneuron-1.1.2}/src/smallneuron/__init__.py +0 -0
- {smallneuron-1.1.0 → smallneuron-1.1.2}/src/smallneuron/build +0 -0
- {smallneuron-1.1.0 → smallneuron-1.1.2}/src/smallneuron/gpio_h3.c +0 -0
- {smallneuron-1.1.0 → smallneuron-1.1.2}/src/smallneuron/gpio_h3.h +0 -0
- {smallneuron-1.1.0 → smallneuron-1.1.2}/src/smallneuron/gpio_h3.so +0 -0
- {smallneuron-1.1.0 → smallneuron-1.1.2}/src/smallneuron/logger.py +0 -0
- {smallneuron-1.1.0 → smallneuron-1.1.2}/src/smallneuron/sndummy.py +0 -0
- {smallneuron-1.1.0 → smallneuron-1.1.2}/src/smallneuron/sngpio.py +0 -0
- {smallneuron-1.1.0 → smallneuron-1.1.2}/src/smallneuron/sninput.py +0 -0
- {smallneuron-1.1.0 → smallneuron-1.1.2}/src/smallneuron/snmqtt.py +0 -0
- {smallneuron-1.1.0 → smallneuron-1.1.2}/src/smallneuron/sntimer.py +0 -0
- {smallneuron-1.1.0 → smallneuron-1.1.2}/src/smallneuron.egg-info/dependency_links.txt +0 -0
- {smallneuron-1.1.0 → smallneuron-1.1.2}/src/smallneuron.egg-info/top_level.txt +0 -0
- {smallneuron-1.1.0 → smallneuron-1.1.2}/src/smallneuron_pelainux.egg-info/PKG-INFO +0 -0
- {smallneuron-1.1.0 → smallneuron-1.1.2}/src/smallneuron_pelainux.egg-info/SOURCES.txt +0 -0
- {smallneuron-1.1.0 → smallneuron-1.1.2}/src/smallneuron_pelainux.egg-info/dependency_links.txt +0 -0
- {smallneuron-1.1.0 → smallneuron-1.1.2}/src/smallneuron_pelainux.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: smallneuron
|
|
3
|
-
Version: 1.1.
|
|
3
|
+
Version: 1.1.2
|
|
4
4
|
Summary: Small Neuron Workflow
|
|
5
5
|
Author-email: Andres Artigas <andres@artigas.cl>
|
|
6
6
|
Project-URL: Homepage, https://github.com/pypa/sampleproject
|
|
@@ -43,4 +43,4 @@ python3 -m twine upload dist/* # prod
|
|
|
43
43
|
Installing module
|
|
44
44
|
sudo python3 -m pip install --upgrade --index-url https://test.pypi.org/simple/ --no-deps smallneuron-pelainux # test
|
|
45
45
|
|
|
46
|
-
sudo python3 -m pip install --upgrade --index-url https://pypi.org/simple/ --no-deps smallneuron==1.
|
|
46
|
+
sudo python3 -m pip install --upgrade --index-url https://pypi.org/simple/ --no-deps smallneuron==1.1.1 # prod
|
|
@@ -29,4 +29,4 @@ python3 -m twine upload dist/* # prod
|
|
|
29
29
|
Installing module
|
|
30
30
|
sudo python3 -m pip install --upgrade --index-url https://test.pypi.org/simple/ --no-deps smallneuron-pelainux # test
|
|
31
31
|
|
|
32
|
-
sudo python3 -m pip install --upgrade --index-url https://pypi.org/simple/ --no-deps smallneuron==1.
|
|
32
|
+
sudo python3 -m pip install --upgrade --index-url https://pypi.org/simple/ --no-deps smallneuron==1.1.1 # prod
|
|
@@ -87,7 +87,7 @@ class EventManager:
|
|
|
87
87
|
if params == None:
|
|
88
88
|
params = {}
|
|
89
89
|
|
|
90
|
-
self.events.put((event, params, {}))
|
|
90
|
+
self.events.put((event, params, {})) # TODO: parece el el tercer argumento no se usa nunca
|
|
91
91
|
|
|
92
92
|
def watchEvent(self,event, event_args={}, event_pattern=None,
|
|
93
93
|
bridge=None, bridge_args={}, mode="loop",period=1):
|
|
@@ -87,24 +87,21 @@ class HttpEvent (Resource):
|
|
|
87
87
|
else:
|
|
88
88
|
return None, 405
|
|
89
89
|
|
|
90
|
+
api.add_resource(PlannerServer, '/<string:action>','/<string:action>/<string:kart_id>') # Kart list status, and plan
|
|
91
|
+
api.add_resource(Order, '/order', '/order/<int:order_id>') # POST New order, GET Order status ,DELETE Order , '/order/<int:order_id>', endpoint="order_id"
|
|
92
|
+
api.add_resource(Task, '/task/<int:task_id>') # End task
|
|
93
|
+
api.add_resource(Kart, '/kart/<string:kart_id>', '/kart/<string:component>/<string:code>') # Checkin and send event
|
|
90
94
|
|
|
91
95
|
class SnHttp(Flask):
|
|
92
96
|
def __init__(self):
|
|
93
97
|
super().__init__(__name__)
|
|
94
98
|
self.app = Flask(__name__)
|
|
95
99
|
self.api = Api(self.app)
|
|
100
|
+
|
|
101
|
+
def add_resource(self, resource, *urls, **kwargs):
|
|
102
|
+
self.api.add_resource(resource, urls, kwargs)
|
|
96
103
|
|
|
97
|
-
def
|
|
98
|
-
self.api.add_resource(HttpEvent, path )
|
|
99
|
-
|
|
100
|
-
def start(self):
|
|
104
|
+
def start(self, service_port=9000):
|
|
101
105
|
self.app.config['MAX_CONTENT_LENGTH'] = 1024 * 1024 * 1024
|
|
102
|
-
self.app.run(debug=False, host= '0.0.0.0')
|
|
103
|
-
|
|
106
|
+
self.app.run(debug=False, host= '0.0.0.0', port=service_port)
|
|
104
107
|
|
|
105
|
-
if __name__ == '__main__':
|
|
106
|
-
except KeyboardInterrupt:
|
|
107
|
-
pass
|
|
108
|
-
finally:
|
|
109
|
-
pass
|
|
110
|
-
#stopAllKarts()
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
# pip install pyserial
|
|
7
7
|
#
|
|
8
8
|
import serial
|
|
9
|
+
import time
|
|
9
10
|
import re
|
|
10
11
|
import threading
|
|
11
12
|
import os.path
|
|
@@ -17,33 +18,46 @@ log=Logger("smallneuron.SnSerial")
|
|
|
17
18
|
def eventWait(snserial):
|
|
18
19
|
try:
|
|
19
20
|
log.info("reader started")
|
|
21
|
+
fails=0
|
|
20
22
|
while True:
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
snserial.eventManager
|
|
29
|
-
|
|
30
|
-
|
|
23
|
+
try:
|
|
24
|
+
if not snserial.isOpen():
|
|
25
|
+
snserial.rotateOpen()
|
|
26
|
+
line = snserial.read_until(snserial.eol)
|
|
27
|
+
fails=0
|
|
28
|
+
for e in snserial.events:
|
|
29
|
+
if re.search(e[1], line) != None:
|
|
30
|
+
if snserial.eventManager == None:
|
|
31
|
+
log.error("Warning eventManager not defined")
|
|
32
|
+
else:
|
|
33
|
+
snserial.eventManager.putEvent(e[0], {"data": str(line)})
|
|
34
|
+
log.info("event ", e[0], line)
|
|
35
|
+
break
|
|
36
|
+
except Exception as e:
|
|
37
|
+
fails=fails+1
|
|
38
|
+
if fails > 10:
|
|
39
|
+
raise("Falla multiples veces lectura serial "+str(fails))
|
|
40
|
+
log.error("Reintentamos lectura "+str(e) )
|
|
41
|
+
time.sleep(1)
|
|
42
|
+
snserial.close()
|
|
43
|
+
|
|
31
44
|
except Exception as e:
|
|
32
45
|
log.error(e)
|
|
33
46
|
log.error(traceback.format_exc())
|
|
34
47
|
snserial.eventManager.putEvent("panic", str(e))
|
|
35
|
-
|
|
48
|
+
|
|
36
49
|
|
|
37
50
|
|
|
38
51
|
class SnSerial(serial.Serial):
|
|
39
52
|
def __init__(self, eventManager, port, baudrate, bytesize, parity, stopbits, endofline: bytes = b"\r"):
|
|
40
53
|
super().__init__(baudrate=baudrate, bytesize=bytesize, parity=parity, stopbits=stopbits)
|
|
41
|
-
self.
|
|
54
|
+
self.originalPort=port
|
|
55
|
+
self.rotateOpen()
|
|
42
56
|
self.eventManager = eventManager
|
|
43
57
|
self.eol = endofline
|
|
44
58
|
self.events = []
|
|
45
59
|
log.info("start")
|
|
46
|
-
|
|
60
|
+
|
|
47
61
|
def addEvent(self, event, pattern=".*"):
|
|
48
62
|
self.events.append((event, pattern))
|
|
49
63
|
|
|
@@ -60,12 +74,13 @@ class SnSerial(serial.Serial):
|
|
|
60
74
|
threading.Thread(target=lambda: eventWait(self)).start()
|
|
61
75
|
|
|
62
76
|
# Intentara abrir la puerta termina con 0 (cero) y falla lo cambiara el final por 1 (uno)
|
|
63
|
-
def rotateOpen(self
|
|
77
|
+
def rotateOpen(self):
|
|
78
|
+
port=self.originalPort
|
|
64
79
|
if not os.path.exists(port):
|
|
65
80
|
port=port[:-1]+"1"
|
|
66
81
|
log.debug("snserial port not exist, trying ",port)
|
|
67
82
|
self.port=port # al parecer esto abre el puerto
|
|
68
|
-
self.open()
|
|
83
|
+
self.open() # pero para estar seguro
|
|
69
84
|
log.debug("snserial port:", port)
|
|
70
85
|
|
|
71
86
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: smallneuron
|
|
3
|
-
Version: 1.1.
|
|
3
|
+
Version: 1.1.2
|
|
4
4
|
Summary: Small Neuron Workflow
|
|
5
5
|
Author-email: Andres Artigas <andres@artigas.cl>
|
|
6
6
|
Project-URL: Homepage, https://github.com/pypa/sampleproject
|
|
@@ -43,4 +43,4 @@ python3 -m twine upload dist/* # prod
|
|
|
43
43
|
Installing module
|
|
44
44
|
sudo python3 -m pip install --upgrade --index-url https://test.pypi.org/simple/ --no-deps smallneuron-pelainux # test
|
|
45
45
|
|
|
46
|
-
sudo python3 -m pip install --upgrade --index-url https://pypi.org/simple/ --no-deps smallneuron==1.
|
|
46
|
+
sudo python3 -m pip install --upgrade --index-url https://pypi.org/simple/ --no-deps smallneuron==1.1.1 # prod
|
|
@@ -10,9 +10,9 @@ src/smallneuron/gpio_h3.h
|
|
|
10
10
|
src/smallneuron/gpio_h3.so
|
|
11
11
|
src/smallneuron/logger.py
|
|
12
12
|
src/smallneuron/smallneuron.py
|
|
13
|
+
src/smallneuron/snapi.py
|
|
13
14
|
src/smallneuron/sndummy.py
|
|
14
15
|
src/smallneuron/sngpio.py
|
|
15
|
-
src/smallneuron/snhttp.py
|
|
16
16
|
src/smallneuron/sninput.py
|
|
17
17
|
src/smallneuron/snmqtt.py
|
|
18
18
|
src/smallneuron/snserial.py
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{smallneuron-1.1.0 → smallneuron-1.1.2}/src/smallneuron_pelainux.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|