planning out api more
This commit is contained in:
6
desktop_app/api/message.py
Normal file
6
desktop_app/api/message.py
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
from api.node import MeshNode
|
||||||
|
|
||||||
|
class Message:
|
||||||
|
def __init__(self, content: str, sender: MeshNode):
|
||||||
|
self.content = content
|
||||||
|
self.sender = sender
|
||||||
@@ -1,12 +1,14 @@
|
|||||||
from enum import Enum
|
from bleak import BleakScanner, BleakClient
|
||||||
from bleak import BLEDevice, BleakScanner, BleakClient
|
|
||||||
|
|
||||||
NODE_BLUETOOTH_SERVICE_UUID = "E1898FF7-5063-4441-a6eb-526073B00001"
|
NODE_BLUETOOTH_SERVICE_UUID = "E1898FF7-5063-4441-a6eb-526073B00001"
|
||||||
|
NODE_BLUETOOTH_RX_UUID = "E1898FF7-5063-4441-a6eb-526073B00002"
|
||||||
|
NODE_BLUETOOTH_TX_UUID = "E1898FF7-5063-4441-a6eb-526073B00003"
|
||||||
|
|
||||||
|
|
||||||
class MeshNode:
|
class MeshNode:
|
||||||
def __init__(self, client: BleakClient):
|
def __init__(self, client: BleakClient):
|
||||||
self.client = client
|
self.client = client
|
||||||
|
self.client.pair()
|
||||||
|
|
||||||
async def discover():
|
async def discover():
|
||||||
"""Find a mesh node via Bluetooth
|
"""Find a mesh node via Bluetooth
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
from textual.app import App, ComposeResult
|
from textual.app import App
|
||||||
from textual.widgets import Header, Footer
|
|
||||||
from ui.screens.pair_screen import PairScreen
|
from ui.screens.pair_screen import PairScreen
|
||||||
from api.node import MeshNode
|
from api.node import MeshNode
|
||||||
|
|
||||||
|
|||||||
16
desktop_app/ui/widgets/chat_window.py
Normal file
16
desktop_app/ui/widgets/chat_window.py
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
from textual.containers import Vertical, VerticalScroll, HorizontalGroup
|
||||||
|
from textual.widgets import Input, Button, Static
|
||||||
|
|
||||||
|
|
||||||
|
class Message(Static):
|
||||||
|
def __init__(self, message):
|
||||||
|
super().__init__()
|
||||||
|
|
||||||
|
class ChatWindow(Vertical):
|
||||||
|
def compose(self):
|
||||||
|
with VerticalScroll():
|
||||||
|
pass
|
||||||
|
|
||||||
|
with HorizontalGroup():
|
||||||
|
yield Input(placeholder="Send a message")
|
||||||
|
yield Button("", flat=True)
|
||||||
Reference in New Issue
Block a user