Beispiel #1
0
    def __init__(self, node, lookup_paths=None):
        if node.is_anonymous:
            raise uavcan.UAVCANException('File server cannot be launched on an anonymous node')

        self.lookup_paths = lookup_paths or []

        self._path_hit_counters = defaultdict(int)
        self._handles = []

        def add_handler(datatype, callback):
            self._handles.append(node.add_handler(datatype, callback))

        add_handler(uavcan.protocol.file.GetInfo, self._get_info)
        add_handler(uavcan.protocol.file.Read, self._read)
Beispiel #2
0
 def _throw_if_anonymous(self):
     if not self._node_id:
         raise uavcan.UAVCANException(
             'The local node is configured in anonymous mode')