Skip to content

Commit

Permalink
refactor: server name is now more generic
Browse files Browse the repository at this point in the history
  • Loading branch information
builder555 committed Feb 20, 2023
1 parent fac790b commit 8f25bcb
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion backend/Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ pytest-asyncio = "*"
python_version = "3.10"

[scripts]
"server" = "python ble_server.py"
"server" = "python main_server.py"
"test" = "pytest"
5 changes: 5 additions & 0 deletions backend/ble_server.py → backend/main_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@

pinecil = Pinecil()

def read_app_version():
with open('../version.txt') as f:
return f.read().strip()

async def process_command(command: str, payload: dict) -> dict:
if not pinecil.is_connected:
await pinecil.connect()
Expand All @@ -30,6 +34,7 @@ async def process_command(command: str, payload: dict) -> dict:
return {'status': 'OK'}
if command == 'GET_INFO':
info = await pinecil.get_info()
info['app_version'] = read_app_version()
return {'status': 'OK', 'payload': info}
return {'status': 'ERROR', 'message': 'Unknown command'}

Expand Down
2 changes: 1 addition & 1 deletion backend/start.bat
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ set LOG_LEVEL=info

python check_install.py

start /b python ble_server.py
start /b python main_server.py
set pidsrv=%ERRORLEVEL%

start /b python -m http.server --directory ../ui 8080
Expand Down

0 comments on commit 8f25bcb

Please sign in to comment.