File tree Expand file tree Collapse file tree 6 files changed +121
-6
lines changed Expand file tree Collapse file tree 6 files changed +121
-6
lines changed Original file line number Diff line number Diff line change 26
26
import pyaudio
27
27
import alsaaudio
28
28
29
- from six . moves import queue
29
+ import queue
30
30
# [END import_libraries]
31
31
32
32
# Audio recording parameters
Original file line number Diff line number Diff line change 1
1
# API framework
2
- connexion == 2.14.2
3
- Flask == 2.2.5
4
- Flask-Cors == 3.0.10
2
+ connexion [uvicorn,flask,swagger-ui ]== 3.0.5
5
3
tinydb == 4.8.0
6
- Werkzeug == 2.2.3
7
4
8
5
# Misc utils
9
6
setuptools == 69.2.0
Original file line number Diff line number Diff line change 2
2
3
3
export PYTHONPATH=./stub:./test:./coderbot
4
4
cd /coderbot
5
- python3 coderbot/main.py
5
+ python3 coderbot/main.py & python3 stub/wifi/main.py
Original file line number Diff line number Diff line change
1
+ import logging
2
+
3
+ def list_access_points ():
4
+ return {"ssids" : [{"ssid" : "my_wifi" }]}
5
+
6
+ def connection_status ():
7
+ return {"wifi" : "true" , "internet" : "true" }
8
+
9
+ def connect ():
10
+ return "ok"
11
+
12
+ def forget ():
13
+ return "ok"
14
+
15
+ def sset_hotspot_ssid ():
16
+ return "ok"
17
+
18
+ def set_hotspot_password ():
19
+ return "ok"
Original file line number Diff line number Diff line change
1
+ #!/usr/bin/python
2
+
3
+ import os
4
+ import logging
5
+ import logging .handlers
6
+ import connexion
7
+ from connexion .middleware import MiddlewarePosition
8
+ from starlette .middleware .cors import CORSMiddleware
9
+
10
+ # Logging configuration
11
+ logger = logging .getLogger ()
12
+ logger .setLevel (os .environ .get ("LOGLEVEL" , "INFO" ))
13
+
14
+ ## (Connexion) Flask app configuration
15
+
16
+ # Serve a custom version of the swagger ui (Jinja2 templates) based on the default one
17
+ # from the folder 'swagger-ui'. Clone the 'swagger-ui' repository inside the backend folder
18
+
19
+ app = connexion .App (__name__ )
20
+ app .add_middleware (
21
+ CORSMiddleware ,
22
+ position = MiddlewarePosition .BEFORE_EXCEPTION ,
23
+ allow_origins = ["*" ],
24
+ allow_credentials = True ,
25
+ allow_methods = ["*" ],
26
+ allow_headers = ["*" ],
27
+ )
28
+
29
+ ## New API and web application
30
+
31
+ # API v1 is defined in v1.yml and its methods are in api.py
32
+ app .add_api ('v1.yml' )
33
+
34
+ if __name__ == "__main__" :
35
+ app .run (host = "0.0.0.0" , port = 9090 )
Original file line number Diff line number Diff line change
1
+ openapi : " 3.0.0"
2
+ info :
3
+ version : " 1.0"
4
+ title : OpenAPI 3.0 definition of WiFi API
5
+
6
+ servers :
7
+ - url : http://coderbot.local/v1
8
+
9
+ # Paths supported by the server application
10
+ paths :
11
+ /list_access_points :
12
+ get :
13
+ operationId : " api.list_access_points"
14
+ summary : " list Access Points"
15
+ responses :
16
+ 200 :
17
+ description : " ok"
18
+ tags :
19
+ - Wifi
20
+ /connection_status :
21
+ get :
22
+ operationId : " api.connection_status"
23
+ summary : " connection Status"
24
+ responses :
25
+ 200 :
26
+ description : " ok"
27
+ tags :
28
+ - Wifi
29
+ /connect :
30
+ post :
31
+ operationId : " api.connect"
32
+ summary : " connect"
33
+ responses :
34
+ 200 :
35
+ description : " ok"
36
+ tags :
37
+ - Wifi
38
+ /forget :
39
+ post :
40
+ operationId : " api.forget"
41
+ summary : " forget"
42
+ responses :
43
+ 200 :
44
+ description : " ok"
45
+ tags :
46
+ - Wifi
47
+ /sset_hotspot_ssid :
48
+ post :
49
+ operationId : " api.sset_hotspot_ssid"
50
+ summary : " sset_hotspot_ssid"
51
+ responses :
52
+ 200 :
53
+ description : " ok"
54
+ tags :
55
+ - Wifi
56
+ /set_hotspot_password :
57
+ post :
58
+ operationId : " api.set_hotspot_password"
59
+ summary : " set_hotspot_password"
60
+ responses :
61
+ 200 :
62
+ description : " ok"
63
+ tags :
64
+ - Wifi
You can’t perform that action at this time.
0 commit comments