mirror of
https://github.com/dptech-corp/Uni-Lab-OS.git
synced 2026-02-04 13:25:13 +00:00
修改host_node
This commit is contained in:
@@ -1159,22 +1159,20 @@ class HostNode(BaseROS2DeviceNode):
|
|||||||
def _resource_get_callback(self, request: SerialCommand.Request, response: SerialCommand.Response):
|
def _resource_get_callback(self, request: SerialCommand.Request, response: SerialCommand.Response):
|
||||||
"""
|
"""
|
||||||
获取资源回调
|
获取资源回调
|
||||||
|
|
||||||
处理获取资源请求,从桥接器或本地查询资源数据
|
处理获取资源请求,从桥接器或本地查询资源数据
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
request: 包含资源ID的请求对象
|
request: 包含资源ID的请求对象
|
||||||
response: 响应对象
|
response: 响应对象
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
响应对象,包含查询到的资源
|
响应对象,包含查询到的资源
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
|
from unilabos.app.web import http_client
|
||||||
data = json.loads(request.command)
|
data = json.loads(request.command)
|
||||||
if "uuid" in data and data["uuid"] is not None:
|
if "uuid" in data and data["uuid"] is not None:
|
||||||
http_req = self.bridges[-1].resource_tree_get([data["uuid"]], data["with_children"])
|
http_req = http_client.resource_tree_get([data["uuid"]], data["with_children"])
|
||||||
elif "id" in data and data["id"].startswith("/"):
|
elif "id" in data and data["id"].startswith("/"):
|
||||||
http_req = self.bridges[-1].resource_get(data["id"], data["with_children"])
|
http_req = http_client.resource_get(data["id"], data["with_children"])
|
||||||
else:
|
else:
|
||||||
raise ValueError("没有使用正确的物料 id 或 uuid")
|
raise ValueError("没有使用正确的物料 id 或 uuid")
|
||||||
response.response = json.dumps(http_req["data"])
|
response.response = json.dumps(http_req["data"])
|
||||||
|
|||||||
Reference in New Issue
Block a user