35 lines
873 B (Stored with Git LFS)
Python
35 lines
873 B (Stored with Git LFS)
Python
from abc import ABC, abstractmethod
|
|
|
|
from gobotrpc.util import *
|
|
|
|
class GobotRPCPackage(ABC):
|
|
@abstractmethod
|
|
def from_json(self, data: dict):
|
|
raise NotImplementedError
|
|
|
|
@abstractmethod
|
|
def to_json(self) -> dict:
|
|
raise NotImplementedError
|
|
|
|
@abstractmethod
|
|
def from_bytes(self, data: bytes):
|
|
raise NotImplementedError
|
|
|
|
@abstractmethod
|
|
def to_bytes(self) -> bytes:
|
|
raise NotImplementedError
|
|
|
|
@abstractmethod
|
|
def get_type(self) -> GobotRPCType:
|
|
raise NotImplementedError
|
|
|
|
@abstractmethod
|
|
def get_rpc(self) -> GobotRPCNumber:
|
|
raise NotImplementedError
|
|
|
|
@abstractmethod
|
|
def __str__(self) -> str:
|
|
raise NotImplementedError
|
|
|
|
from gobotrpc.mapping import parse_package_from_bytes
|
|
from gobotrpc.packages import GobotRPCVacumRequest, GobotRPCVacumResponse |