some packet types were commands vim packets.py !

This commit is contained in:
Florent
2026-02-14 09:50:36 -04:00
parent 03a2a7c64e
commit 9100a979dc
3 changed files with 60 additions and 9 deletions

View File

@@ -3,7 +3,7 @@ import random
from .base import CommandHandlerBase
from ..events import EventType, Event
from ..packets import ControlType, PacketType
from ..packets import ControlType, CommandType
logger = logging.getLogger("meshcore")
@@ -14,7 +14,7 @@ class ControlDataCommandHandler(CommandHandlerBase):
"""Helper functions to handle binary requests through binary commands"""
async def send_control_data (self, control_type: int, payload: bytes) -> Event:
data = bytearray([PacketType.SEND_CONTROL_DATA.value])
data = bytearray([CommandType.SEND_CONTROL_DATA.value])
data.extend(control_type.to_bytes(1, "little", signed = False))
data.extend(payload)

View File

@@ -4,7 +4,7 @@ from typing import Optional, Union
from hashlib import sha256
from ..events import Event, EventType
from ..packets import PacketType
from ..packets import CommandType
from .base import CommandHandlerBase, DestinationType, _validate_destination
logger = logging.getLogger("meshcore")
@@ -252,7 +252,7 @@ class MessagingCommands(CommandHandlerBase):
logger.debug(f"Setting scope to {scope_key.hex()}")
cmd_data = bytearray([PacketType.SET_FLOOD_SCOPE.value])
cmd_data = bytearray([CommandType.SET_FLOOD_SCOPE.value])
cmd_data.extend(b"\0")
cmd_data.extend(scope_key)