mirror of
https://github.com/qmk/qmk_firmware.git
synced 2026-09-25 19:38:56 +02:00
Prep client gen for header parsing
This commit is contained in:
@@ -1,4 +1,8 @@
|
||||
|
||||
class XAPRouteError(Exception):
|
||||
pass
|
||||
|
||||
|
||||
class XAPRoutes():
|
||||
{%- for id, route in xap.routes | dictsort %}
|
||||
{%- if route.routes %}
|
||||
|
||||
@@ -1,8 +1,34 @@
|
||||
from collections import namedtuple
|
||||
from enum import IntFlag, IntEnum
|
||||
from struct import Struct
|
||||
|
||||
|
||||
class XAPRouteError(Exception):
|
||||
pass
|
||||
class XAPRequest(namedtuple('XAPRequest', 'token length data')):
|
||||
fmt = Struct('<HB61s')
|
||||
|
||||
def __new__(cls, *args):
|
||||
return super().__new__(cls, *args)
|
||||
|
||||
@staticmethod
|
||||
def from_bytes(data):
|
||||
return XAPRequest._make(XAPRequest.fmt.unpack(data))
|
||||
|
||||
def to_bytes(self):
|
||||
return self.fmt.pack(*list(self))
|
||||
|
||||
|
||||
class XAPResponse(namedtuple('XAPResponse', 'token flags length data')):
|
||||
fmt = Struct('<HBB60s')
|
||||
|
||||
def __new__(cls, *args):
|
||||
return super().__new__(cls, *args)
|
||||
|
||||
@staticmethod
|
||||
def from_bytes(data):
|
||||
return XAPResponse._make(XAPResponse.fmt.unpack(data))
|
||||
|
||||
def to_bytes(self):
|
||||
return self.fmt.pack(*list(self))
|
||||
|
||||
|
||||
class XAPSecureStatus(IntEnum):
|
||||
|
||||
Reference in New Issue
Block a user