Skip to content

Commit 06565f2

Browse files
committed
rpc_wrappers: kv_read: add vla_from_buffer_copy
Add a `vla_from_buffer_copy` method to the response decoder so it is broadly compatible with `VLACompatLittleEndianStruct`. Signed-off-by: Jordan Yates <jordan@embeint.com>
1 parent 680426c commit 06565f2

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

src/infuse_iot/rpc_wrappers/kv_read.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class request(ctypes.LittleEndianStructure):
2020

2121
class response:
2222
@classmethod
23-
def from_buffer_copy(cls, source: bytes, _offset: int = 0):
23+
def from_buffer_copy(cls, source: bytes, _offset: int = 0) -> list:
2424
values = []
2525
while len(source) > 0:
2626

@@ -50,6 +50,10 @@ class kv_store_value(ctypes.LittleEndianStructure):
5050
source = source[ctypes.sizeof(struct) :]
5151
return values
5252

53+
@classmethod
54+
def vla_from_buffer_copy(cls, source: bytes, offset: int = 0) -> list:
55+
return cls.from_buffer_copy(source, offset)
56+
5357
@classmethod
5458
def add_parser(cls, parser):
5559
parser.add_argument("--keys", "-k", required=True, type=int, nargs="+", help="Keys to read")

0 commit comments

Comments
 (0)