mirror of
https://github.com/m-labs/artiq.git
synced 2024-12-29 21:23:34 +08:00
coredevice/comm_kernel: implement attributes writeback
This commit is contained in:
parent
aa8dfaf0f0
commit
457f3c72ce
@ -6,6 +6,7 @@ import socket
|
||||
import re
|
||||
import linecache
|
||||
import os
|
||||
import json
|
||||
from enum import Enum
|
||||
from fractions import Fraction
|
||||
from collections import namedtuple
|
||||
@ -657,7 +658,17 @@ class CommKernel:
|
||||
return_tags = self._read_bytes()
|
||||
|
||||
if service_id == 0:
|
||||
def service(obj, attr, value): return setattr(obj, attr, value)
|
||||
def service(header, *values):
|
||||
counter = 0
|
||||
for obj in json.loads(header):
|
||||
old_val = embedding_map.globals_map[obj["id"]]
|
||||
if "fields" in obj:
|
||||
for name in obj["fields"]:
|
||||
setattr(old_val, name, values[counter])
|
||||
counter += 1
|
||||
else:
|
||||
old_val[:] = values[counter]
|
||||
counter += 1
|
||||
else:
|
||||
service = embedding_map.retrieve_function(service_id)
|
||||
logger.debug("rpc service: [%d]%r%s %r %r -> %s", service_id, service,
|
||||
|
@ -9,6 +9,7 @@ class EmbeddingMap:
|
||||
self.string_map = {}
|
||||
self.string_reverse_map = {}
|
||||
self.function_map = {}
|
||||
self.globals_map = {}
|
||||
|
||||
# preallocate exception names
|
||||
# must be kept in sync with EXCEPTION_ID_LOOKUP in artiq/firmware/ksupport/eh_artiq.rs,
|
||||
|
Loading…
Reference in New Issue
Block a user