完善模式卡片、NFC及多设备控制流程

This commit is contained in:
minghanchen
2026-09-01 16:18:57 +08:00
parent ca26259e63
commit cbf230182d
15 changed files with 1092 additions and 191 deletions
+10 -7
View File
@@ -970,7 +970,7 @@ class SelfExtensionTests(unittest.TestCase):
["failed"],
)
def test_submitted_emit_without_ack_continues_complete_infrared_plan(self) -> None:
def test_power_on_then_white_waits_800ms_and_continues_without_ack(self) -> None:
service = SelfExtensionService(SimulationGateway())
catalog = [
{
@@ -984,7 +984,7 @@ class SelfExtensionTests(unittest.TestCase):
}
for capability_id, action, slot in (
("light-on", "打开", 1),
("light-green", "切换到绿色", 4),
("light-white", "切换到白色", 6),
)
]
@@ -1009,16 +1009,18 @@ class SelfExtensionTests(unittest.TestCase):
"execute_gateway",
side_effect=submit_without_ack,
) as execute_gateway,
patch("cognitive_agent.application.self_extension.time.sleep"),
patch(
"cognitive_agent.application.self_extension.time.sleep"
) as sleep,
):
result = service.execute_peripheral_plan_request(
"开启闪光灯,颜色设置为绿色",
"启动闪烁灯,颜色设置为白色",
{
"provider_used": "infrared_local_rules",
"summary": "打开闪光灯并切换为绿色",
"summary": "启动闪烁灯并切换为白色",
"steps": [
{"kind": "peripheral", "capability_id": "light-on"},
{"kind": "peripheral", "capability_id": "light-green"},
{"kind": "peripheral", "capability_id": "light-white"},
],
},
catalog,
@@ -1027,11 +1029,12 @@ class SelfExtensionTests(unittest.TestCase):
)
self.assertEqual(execute_gateway.call_count, 2)
sleep.assert_called_once_with(0.8)
self.assertEqual(result["status"], "succeeded")
self.assertEqual(result["sequence"]["emit_count"], 2)
self.assertEqual(
[item["telemetry"]["slot"] for item in result["operation_results"]],
[1, 4],
[1, 6],
)
self.assertEqual(
[