增加了相关文档说明

This commit is contained in:
2026-05-11 10:32:35 +08:00
parent 0f5368bb51
commit 773b506f40
34 changed files with 6745 additions and 0 deletions

View File

@@ -0,0 +1,88 @@
<?xml version="1.0" encoding="UTF-8"?>
<mxfile host="app.diagrams.net" modified="2026-05-10T00:00:00.000Z"
agent="AI-Drawio-Replicator" version="24.0.0" type="device">
<diagram id="page-1" name="传感器工厂模式">
<mxGraphModel dx="1400" dy="900" grid="1" gridSize="10"
guides="1" tooltips="1" connect="1" arrows="1"
fold="1" page="1" pageScale="1"
pageWidth="1400" pageHeight="900"
background="#f0f8ff">
<root>
<mxCell id="0"/>
<mxCell id="1" parent="0"/>
<!-- 应用层 -->
<mxCell id="2" value="&lt;div style=&quot;display:flex;align-items:center;justify-content:center;gap:15px;font-size:20px;font-weight:bold;&quot;&gt;&lt;div style=&quot;font-size:40px;&quot;&gt;📱&lt;/div&gt;&lt;div&gt;应用层&lt;br&gt;&lt;span style=&quot;font-size:16px;font-weight:normal;&quot;&gt;(调用者)&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#e6f2ff;strokeColor=#6699cc;strokeWidth=2;shadow=1;fontSize=14;" vertex="1" parent="1">
<mxGeometry x="100" y="80" width="220" height="100" as="geometry"/>
</mxCell>
<!-- 代码示例 -->
<mxCell id="3" value="&lt;div style=&quot;font-family:monospace;font-size:18px;line-height:1.6;&quot;&gt;sensor = &lt;span style=&quot;color:#0066cc;font-weight:bold;&quot;&gt;sensor_create&lt;/span&gt;(SENSOR_DS18B20);&lt;br&gt;sensor-&gt;read(); &lt;span style=&quot;color:#666666;&quot;&gt;// 不关心具体实现&lt;/span&gt;&lt;/div&gt;" style="text;html=1;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="1">
<mxGeometry x="380" y="80" width="600" height="100" as="geometry"/>
</mxCell>
<!-- 工厂函数 -->
<mxCell id="4" value="&lt;div style=&quot;display:flex;align-items:center;justify-content:center;gap:15px;font-size:24px;font-weight:bold;&quot;&gt;&lt;div style=&quot;font-size:40px;&quot;&gt;🏭&lt;/div&gt;&lt;div&gt;工厂函数&lt;/div&gt;&lt;/div&gt;" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#e6f9f2;strokeColor=#33cc99;strokeWidth=3;shadow=1;fontSize=14;" vertex="1" parent="1">
<mxGeometry x="400" y="280" width="280" height="100" as="geometry"/>
</mxCell>
<!-- 工厂函数说明 -->
<mxCell id="5" value="&lt;div style=&quot;font-size:16px;&quot;&gt;根据类型参数,选择并返回对应的操作集合&lt;/div&gt;" style="text;html=1;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="1">
<mxGeometry x="720" y="320" width="350" height="30" as="geometry"/>
</mxCell>
<!-- 传感器操作接口容器 -->
<mxCell id="6" value="" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#e6f2ff;strokeColor=#6699cc;strokeWidth=3;shadow=1;fontSize=14;" vertex="1" parent="1">
<mxGeometry x="250" y="500" width="700" height="280" as="geometry"/>
</mxCell>
<!-- 传感器操作接口标题 -->
<mxCell id="7" value="&lt;div style=&quot;font-size:24px;font-weight:bold;text-align:center;&quot;&gt;传感器操作接口&lt;/div&gt;" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#f0f7ff;strokeColor=#6699cc;strokeWidth=2;fontSize=14;" vertex="1" parent="6">
<mxGeometry x="50" y="20" width="600" height="50" as="geometry"/>
</mxCell>
<!-- DS18B20传感器 -->
<mxCell id="8" value="&lt;div style=&quot;display:flex;align-items:center;justify-content:center;gap:10px;font-size:20px;font-weight:bold;&quot;&gt;&lt;div style=&quot;font-size:36px;&quot;&gt;🌡️&lt;/div&gt;&lt;div&gt;DS18B20&lt;br&gt;&lt;span style=&quot;font-size:16px;font-weight:normal;font-family:monospace;&quot;&gt;.init&lt;br&gt;.read&lt;br&gt;.deinit&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#f0f7ff;strokeColor=#6699cc;strokeWidth=2;fontSize=14;" vertex="1" parent="6">
<mxGeometry x="50" y="100" width="180" height="160" as="geometry"/>
</mxCell>
<!-- NTC传感器 -->
<mxCell id="9" value="&lt;div style=&quot;display:flex;align-items:center;justify-content:center;gap:10px;font-size:20px;font-weight:bold;&quot;&gt;&lt;div style=&quot;font-size:36px;&quot;&gt;🌡️&lt;/div&gt;&lt;div&gt;NTC&lt;br&gt;&lt;span style=&quot;font-size:16px;font-weight:normal;font-family:monospace;&quot;&gt;.init&lt;br&gt;.read&lt;br&gt;.deinit&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#e6f9f2;strokeColor=#33cc99;strokeWidth=2;fontSize=14;" vertex="1" parent="6">
<mxGeometry x="260" y="100" width="180" height="160" as="geometry"/>
</mxCell>
<!-- PT100传感器 -->
<mxCell id="10" value="&lt;div style=&quot;display:flex;align-items:center;justify-content:center;gap:10px;font-size:20px;font-weight:bold;&quot;&gt;&lt;div style=&quot;font-size:36px;&quot;&gt;🌡️&lt;/div&gt;&lt;div&gt;PT100&lt;br&gt;&lt;span style=&quot;font-size:16px;font-weight:normal;font-family:monospace;&quot;&gt;.init&lt;br&gt;.read&lt;br&gt;.deinit&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#f0f7ff;strokeColor=#6699cc;strokeWidth=2;fontSize=14;" vertex="1" parent="6">
<mxGeometry x="470" y="100" width="180" height="160" as="geometry"/>
</mxCell>
<!-- 连线1应用层到工厂函数 -->
<mxCell id="11" value="&lt;div style=&quot;font-size:16px;&quot;&gt;调用工厂函数&lt;/div&gt;" style="endArrow=classic;html=1;strokeColor=#336699;strokeWidth=2;labelPosition=top;verticalAlign=bottom;labelBackgroundColor=#ffffff;" edge="1" parent="1" source="2" target="4">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="210" y="180" as="sourcePoint"/>
<mxPoint x="210" y="280" as="targetPoint"/>
<mxPoint x="400" y="280" as="targetPoint"/>
</mxGeometry>
</mxCell>
<!-- 连线2工厂函数到传感器接口 -->
<mxCell id="12" value="&lt;div style=&quot;font-size:16px;&quot;&gt;返回具体实例&lt;/div&gt;" style="endArrow=classic;html=1;strokeColor=#33cc99;strokeWidth=3;labelPosition=right;verticalAlign=middle;labelBackgroundColor=#ffffff;" edge="1" parent="1" source="4" target="6">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="540" y="380" as="sourcePoint"/>
<mxPoint x="540" y="500" as="targetPoint"/>
</mxGeometry>
</mxCell>
<!-- 装饰性图标 -->
<mxCell id="13" value="📄" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;fontSize=32;" vertex="1" parent="1">
<mxGeometry x="480" y="200" width="40" height="40" as="geometry"/>
</mxCell>
<!-- 装饰性箭头 -->
<mxCell id="14" value="⬇️" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;fontSize:48px;color:#33cc99;" vertex="1" parent="1">
<mxGeometry x="520" y="420" width="40" height="60" as="geometry"/>
</mxCell>
</root>
</mxGraphModel>
</diagram>
</mxfile>