# 开发传感器

本节介绍了客户端应用程序如何与 QSH 框架交互。然后，进一步解释了 QSH 框架内传感器驱动程序和传感器算法的开发和集成过程。此外，还介绍了传感器校准的程序。

## Qualcomm 传感中枢客户端 API 工作流

Qualcomm 传感中枢 (QSH) 公开的 API 称为应用程序的 QSH 客户端 API。客户端应用与低功耗处理器上的 QSH 框架进行交互。下图显示了 QSH 客户端 API 的详细细分和使用情况。

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<!-- Generated by Microsoft Visio, SVG Export qsh-client-api-workflow.svg Page-1 -->
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:ev="http://www.w3.org/2001/xml-events" xmlns:v="http://schemas.microsoft.com/visio/2003/SVGExtensions/" width="4.97917in" height="5.63542in" viewbox="0 0 358.5 405.75" xml:space="preserve" color-interpolation-filters="sRGB" class="st20" aria-label="图：QSH 客户端 API 工作流程"><v:documentproperties v:langid="1033">	<v:userdefs>		<v:ud v:nameu="msvNoAutoConnect" v:val="VT0(1):26"></v:ud>	</v:userdefs></v:documentproperties>
<style>.svg-1 .st1 { fill: #f7f8fa; stroke: none; stroke-linecap: round; stroke-linejoin: round; stroke-width: 0.75 }
.svg-1 .st2 { fill: #f7f8fa; stroke: #000000; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1 }
.svg-1 .st3 { fill: #000000; font-family: SimHei; font-size: 1.00001em }
.svg-1 .st4 { fill: #000000; font-family: Arial; font-size: 1.00001em }
.svg-1 .st5 { fill: none; stroke: none; stroke-width: 1 }
.svg-1 .st6 { fill: none }
.svg-1 .st7 { stroke: #000000; stroke-dasharray: 7, 5; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1 }
.svg-1 .st8 { marker-end: url("#mrkr5-26"); stroke: #000000; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1 }
.svg-1 .st9 { fill: #000000; fill-opacity: 1; stroke: #000000; stroke-opacity: 1; stroke-width: 0.28409102939153 }
.svg-1 .st10 { fill: #ffffff; stroke: none; stroke-linecap: butt; stroke-width: 7.2 }
.svg-1 .st11 { fill: #000000; font-family: Arial; font-size: 0.833336em }
.svg-1 .st12 { marker-start: url("#mrkr5-34"); stroke: #000000; stroke-dasharray: 7, 5; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1 }
.svg-1 .st13 { fill: #000000; font-family: SimHei; font-size: 0.833336em }
.svg-1 .st14 { font-family: Arial; font-size: 1em }
.svg-1 .st15 { fill: none; stroke: #000000; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1 }
.svg-1 .st16 { fill: #ffffff; stroke: none; stroke-linecap: butt }
.svg-1 .st17 { fill: none; stroke: none; stroke-linecap: round; stroke-linejoin: round; stroke-width: 0.75 }
.svg-1 .st18 { fill: #000000; font-family: Arial; font-size: 0.666664em }
.svg-1 .st19 { marker-end: url("#mrkr5-26"); stroke: #000000; stroke-linecap: butt; stroke-width: 1 }
.svg-1 .st20 { fill: none; fill-rule: evenodd; font-size: 12px; overflow: visible; stroke-linecap: square; stroke-miterlimit: 3 }</style>
<defs id="Markers">	<g id="lend5">		<path d="M 2 1 L 0 0 L 1.98117 -0.993387 C 1.67173 -0.364515 1.67301 0.372641 1.98465 1.00043 " style="stroke:none"></path>	</g>	<marker id="mrkr5-26" class="st9" v:arrowtype="5" v:arrowsize="2" v:setback="6.16" refx="-6.1599973914988" orient="auto" markerunits="strokeWidth" overflow="visible">		<use xlink:href="#lend5" transform="scale(-3.5199985094279,-3.5199985094279) "></use>	</marker>	<marker id="mrkr5-34" class="st9" v:arrowtype="5" v:arrowsize="2" v:setback="0" refx="0" orient="auto" markerunits="strokeWidth" overflow="visible">		<use xlink:href="#lend5" transform="scale(3.5199985094279) "></use>	</marker></defs><g v:mid="0" v:index="1" v:groupcontext="foregroundPage">	<title>Page-1</title>	<v:pageproperties v:drawingscale="1" v:pagescale="1" v:drawingunits="19" v:shadowoffsetx="9.00002" v:shadowoffsety="-9.00002"></v:pageproperties>	<g id="shape1-1" v:mid="1" v:groupcontext="shape" transform="translate(18.375,-19.1248)">		<title>shape30-1</title>		<rect x="0" y="36.75" width="321.75" height="369" class="st1"></rect>	</g>	<g id="shape2-3" v:mid="2" v:groupcontext="shape" transform="translate(73.2502,-356.75)">		<title>shape2-3</title>		<desc>Application</desc>		<v:userdefs></v:userdefs>		<v:textblock v:margins="rect(4,4,4,4)"></v:textblock>		<v:textrect cx="42.75" cy="392.25" width="85.52" height="27"></v:textrect>		<rect x="0" y="378.75" width="85.5002" height="27" class="st2"></rect>		<text x="18.75" y="395.85" class="st3" v:langid="2052"><v:paragraph v:horizalign="1"></v:paragraph><v:tablist></v:tablist>应用程序</text>		</g>	<g id="shape3-6" v:mid="3" v:groupcontext="shape" transform="translate(202.625,-356.75)">		<title>shape4-6</title>		<desc>libSensingHubSession</desc>		<v:userdefs></v:userdefs>		<v:textblock v:margins="rect(4,4,4,4)"></v:textblock>		<v:textrect cx="66.375" cy="392.25" width="132.77" height="27"></v:textrect>		<rect x="0" y="378.75" width="132.75" height="27" class="st2"></rect>		<text x="6.34" y="395.85" class="st4" v:langid="2052"><v:paragraph v:horizalign="1"></v:paragraph><v:tablist></v:tablist>libSensingHubSession</text>		</g>	<g id="group4-9" transform="translate(520.625,49) rotate(90)" v:mid="4" v:groupcontext="group">		<title>shape5-9</title>		<g id="shape5-10" v:mid="5" v:groupcontext="shape">			<title>Sheet.5</title>			<path d="M0 405.75 L306.07 405.75 L0 405.75 Z" class="st5"></path>		</g>		<g id="shape6-12" v:mid="6" v:groupcontext="shape">			<title>Sheet.6</title>			<path d="M0 405.75 L306.07 405.75 L0 405.75 Z" class="st6"></path>			<path d="M0 405.75 L306.07 405.75" class="st7"></path>		</g>	</g>	<g id="group7-15" transform="translate(674.75,49) rotate(90)" v:mid="7" v:groupcontext="group">		<title>shape6-12</title>		<g id="shape8-16" v:mid="8" v:groupcontext="shape">			<title>Sheet.8</title>			<path d="M0 405.75 L305.85 405.75 L0 405.75 Z" class="st5"></path>		</g>		<g id="shape9-18" v:mid="9" v:groupcontext="shape">			<title>Sheet.9</title>			<path d="M0 405.75 L305.85 405.75 L0 405.75 Z" class="st6"></path>			<path d="M0 405.75 L305.85 405.75" class="st7"></path>		</g>	</g>	<g id="shape10-21" v:mid="10" v:groupcontext="shape" transform="translate(114.875,-338.75)">		<title>shape7-15</title>		<desc>getSession</desc>		<v:userdefs></v:userdefs>		<v:textblock v:margins="rect(4,4,4,4)"></v:textblock>		<v:textrect cx="77.0625" cy="405.75" width="154.15" height="0"></v:textrect>		<path d="M0 405.75 L147.96 405.75 L147.96 405.75" class="st8"></path>		<rect v:rectcontext="textBkgnd" x="52.3234" y="399.75" width="49.4783" height="12.0001" class="st10"></rect>		<text x="52.32" y="408.75" class="st11" v:langid="2052"><v:paragraph v:horizalign="1"></v:paragraph><v:tablist></v:tablist>getSession</text>		</g>	<g id="shape11-29" v:mid="11" v:groupcontext="shape" transform="translate(114.875,-320.75)">		<title>shape8-23</title>		<desc>ISession*</desc>		<v:userdefs></v:userdefs>		<v:textblock v:margins="rect(4,4,4,4)"></v:textblock>		<v:textrect cx="77.0625" cy="405.75" width="154.15" height="0"></v:textrect>		<path d="M0 405.75 L5.8 405.75 L6.16 405.75 L154.12 405.75" class="st12"></path>		<rect v:rectcontext="textBkgnd" x="55.9393" y="399.75" width="42.2468" height="12.0001" class="st10"></rect>		<text x="55.94" y="408.75" class="st11" v:langid="2052"><v:paragraph v:horizalign="1"></v:paragraph><v:tablist></v:tablist>ISession*</text>		</g>	<g id="shape12-37" v:mid="12" v:groupcontext="shape" transform="translate(114.875,-302.75)">		<title>shape9-31</title>		<desc>Open</desc>		<v:userdefs></v:userdefs>		<v:textblock v:margins="rect(4,4,4,4)"></v:textblock>		<v:textrect cx="77.0625" cy="405.75" width="154.15" height="0"></v:textrect>		<path d="M0 405.75 L147.96 405.75 L147.96 405.75" class="st8"></path>		<rect v:rectcontext="textBkgnd" x="64.831" y="399.75" width="24.463" height="12.0001" class="st10"></rect>		<text x="64.83" y="408.75" class="st11" v:langid="2052"><v:paragraph v:horizalign="1"></v:paragraph><v:tablist></v:tablist>Open</text>		</g>	<g id="shape13-44" v:mid="13" v:groupcontext="shape" transform="translate(114.875,-284.75)">		<title>shape10-38</title>		<desc>success/fail</desc>		<v:userdefs></v:userdefs>		<v:textblock v:margins="rect(4,4,4,4)"></v:textblock>		<v:textrect cx="77.0625" cy="405.75" width="154.15" height="0"></v:textrect>		<path d="M0 405.75 L5.8 405.75 L6.16 405.75 L154.12 405.75" class="st12"></path>		<rect v:rectcontext="textBkgnd" x="55.6734" y="399.249" width="42.7786" height="13.0037" class="st10"></rect>		<text x="55.67" y="409" class="st13" v:langid="2052"><v:paragraph v:horizalign="1"></v:paragraph><v:tablist></v:tablist>成功<tspan class="st14">/</tspan>失败</text>		</g>	<g id="shape14-52" v:mid="14" v:groupcontext="shape" transform="translate(23.75,-131.75)">		<title>shape11-45</title>		<rect x="0" y="263.438" width="310.5" height="142.312" class="st15"></rect>	</g>	<g id="shape15-54" v:mid="15" v:groupcontext="shape" transform="translate(114.875,-253.25)">		<title>shape12-47</title>		<desc>setCallBacks</desc>		<v:userdefs></v:userdefs>		<v:textblock v:margins="rect(4,4,4,4)"></v:textblock>		<v:textrect cx="77.0625" cy="405.75" width="154.15" height="0"></v:textrect>		<path d="M0 405.75 L147.96 405.75 L147.96 405.75" class="st8"></path>		<rect v:rectcontext="textBkgnd" x="48.1631" y="399.75" width="57.7988" height="12.0001" class="st10"></rect>		<text x="48.16" y="408.75" class="st11" v:langid="2052"><v:paragraph v:horizalign="1"></v:paragraph><v:tablist></v:tablist>setCallBacks</text>		</g>	<g id="shape16-61" v:mid="16" v:groupcontext="shape" transform="translate(114.875,-237.5)">		<title>shape13-54</title>		<desc>success/fail</desc>		<v:userdefs></v:userdefs>		<v:textblock v:margins="rect(4,4,4,4)"></v:textblock>		<v:textrect cx="77.0625" cy="405.75" width="154.15" height="0"></v:textrect>		<path d="M0 405.75 L5.8 405.75 L6.16 405.75 L154.12 405.75" class="st12"></path>		<rect v:rectcontext="textBkgnd" x="55.6734" y="399.249" width="42.7786" height="13.0037" class="st10"></rect>		<text x="55.67" y="409" class="st13" v:langid="2052"><v:paragraph v:horizalign="1"></v:paragraph><v:tablist></v:tablist>成功<tspan class="st14">/</tspan>失败</text>		</g>	<g id="shape17-69" v:mid="17" v:groupcontext="shape" transform="translate(114.875,-212.75)">		<title>shape14-61</title>		<desc>sendRequest</desc>		<v:userdefs></v:userdefs>		<v:textblock v:margins="rect(4,4,4,4)"></v:textblock>		<v:textrect cx="77.0625" cy="405.75" width="154.15" height="0"></v:textrect>		<path d="M0 405.75 L147.96 405.75 L147.96 405.75" class="st8"></path>		<rect v:rectcontext="textBkgnd" x="47.5971" y="399.75" width="58.9312" height="12.0001" class="st16"></rect>		<text x="47.6" y="408.75" class="st11" v:langid="2052"><v:paragraph v:horizalign="1"></v:paragraph><v:tablist></v:tablist>sendRequest</text>		</g>	<g id="shape18-76" v:mid="18" v:groupcontext="shape" transform="translate(114.875,-197)">		<title>shape15-68</title>		<desc>success/fail</desc>		<v:userdefs></v:userdefs>		<v:textblock v:margins="rect(4,4,4,4)"></v:textblock>		<v:textrect cx="77.0625" cy="405.75" width="154.15" height="0"></v:textrect>		<path d="M0 405.75 L5.8 405.75 L6.16 405.75 L154.12 405.75" class="st12"></path>		<rect v:rectcontext="textBkgnd" x="55.6734" y="399.249" width="42.7786" height="13.0037" class="st10"></rect>		<text x="55.67" y="409" class="st13" v:langid="2052"><v:paragraph v:horizalign="1"></v:paragraph><v:tablist></v:tablist>成功<tspan class="st14">/</tspan>失败</text>		</g>	<g id="shape19-84" v:mid="19" v:groupcontext="shape" transform="translate(32.25,-140.75)">		<title>shape16-75</title>		<rect x="0" y="360.75" width="288.5" height="45" class="st15"></rect>	</g>	<g id="shape20-86" v:mid="20" v:groupcontext="shape" transform="translate(114.875,-156.5)">		<title>shape17-77</title>		<desc>sensorEvent</desc>		<v:userdefs></v:userdefs>		<v:textblock v:margins="rect(4,4,4,4)"></v:textblock>		<v:textrect cx="77.0625" cy="405.75" width="154.15" height="0"></v:textrect>		<path d="M0 405.75 L5.8 405.75 L6.16 405.75 L154.12 405.75" class="st12"></path>		<rect v:rectcontext="textBkgnd" x="49.2692" y="399.75" width="55.5867" height="12.0001" class="st10"></rect>		<text x="49.27" y="408.75" class="st11" v:langid="2052"><v:paragraph v:horizalign="1"></v:paragraph><v:tablist></v:tablist>sensorEvent</text>		</g>	<g id="shape21-93" v:mid="21" v:groupcontext="shape" transform="translate(114.875,-113.75)">		<title>shape18-84</title>		<desc>close()</desc>		<v:userdefs></v:userdefs>		<v:textblock v:margins="rect(4,4,4,4)"></v:textblock>		<v:textrect cx="77.0625" cy="405.75" width="154.15" height="0"></v:textrect>		<path d="M0 405.75 L147.96 405.75 L147.96 405.75" class="st8"></path>		<rect v:rectcontext="textBkgnd" x="62.06" y="399.75" width="30.005" height="12.0001" class="st10"></rect>		<text x="62.06" y="408.75" class="st11" v:langid="2052"><v:paragraph v:horizalign="1"></v:paragraph><v:tablist></v:tablist>close()</text>		</g>	<g id="shape22-100" v:mid="22" v:groupcontext="shape" transform="translate(114.875,-95.7502)">		<title>shape19-91</title>		<path d="M0 405.75 L5.8 405.75 L6.16 405.75 L154.12 405.75" class="st12"></path>	</g>	<g id="shape23-105" v:mid="23" v:groupcontext="shape" transform="translate(72.1252,-23.75)">		<title>shape21-101</title>		<desc>Application</desc>		<v:userdefs></v:userdefs>		<v:textblock v:margins="rect(4,4,4,4)"></v:textblock>		<v:textrect cx="42.75" cy="392.25" width="85.52" height="27"></v:textrect>		<rect x="0" y="378.75" width="85.5002" height="27" class="st2"></rect>		<text x="18.75" y="395.85" class="st3" v:langid="2052"><v:paragraph v:horizalign="1"></v:paragraph><v:tablist></v:tablist>应用程序</text>		</g>	<g id="shape24-108" v:mid="24" v:groupcontext="shape" transform="translate(202.625,-23.75)">		<title>shape22-104</title>		<desc>libSensingHubSession</desc>		<v:userdefs></v:userdefs>		<v:textblock v:margins="rect(4,4,4,4)"></v:textblock>		<v:textrect cx="66.375" cy="392.25" width="132.77" height="27"></v:textrect>		<rect x="0" y="378.75" width="132.75" height="27" class="st2"></rect>		<text x="6.34" y="395.85" class="st4" v:langid="2052"><v:paragraph v:horizalign="1"></v:paragraph><v:tablist></v:tablist>libSensingHubSession</text>		</g>	<g id="shape25-111" v:mid="25" v:groupcontext="shape" transform="translate(29.375,-72.125)">		<title>shape23-107</title>		<desc>delete ISession*</desc>		<v:userdefs></v:userdefs>		<v:textblock v:margins="rect(4,4,4,4)"></v:textblock>		<v:textrect cx="41.625" cy="400.687" width="83.27" height="10.125"></v:textrect>		<rect x="0" y="395.625" width="83.25" height="10.125" class="st17"></rect>		<text x="9.11" y="403.94" class="st13" v:langid="2052"><v:paragraph v:horizalign="1"></v:paragraph><v:tablist></v:tablist>删除<tspan class="st14"> </tspan><tspan class="st14">ISession*</tspan></text>		</g>	<g id="shape26-116" v:mid="26" v:groupcontext="shape" transform="translate(23.75,537.437) scale(1,-1)">		<title>shape26-110</title>		<desc>opt</desc>		<v:userdefs>			<v:ud v:nameu="CTypeTopLeftSnip" v:prompt="" v:val="VT0(0):5"></v:ud>			<v:ud v:nameu="CTypeTopRightSnip" v:prompt="" v:val="VT0(1):5"></v:ud>			<v:ud v:nameu="CTypeBotLeftSnip" v:prompt="" v:val="VT0(1):5"></v:ud>			<v:ud v:nameu="CTypeBotRightSnip" v:prompt="" v:val="VT0(0):5"></v:ud>			<v:ud v:nameu="CornerLockHoriz" v:prompt="" v:val="VT0(0):5"></v:ud>			<v:ud v:nameu="CornerLockVert" v:prompt="" v:val="VT0(0):5"></v:ud>			<v:ud v:nameu="CornerLockDiag" v:prompt="" v:val="VT0(0):5"></v:ud>			<v:ud v:nameu="TopLeftOffset" v:prompt="" v:val="VT0(0):1"></v:ud>			<v:ud v:nameu="TopRightOffset" v:prompt="" v:val="VT0(0):26"></v:ud>			<v:ud v:nameu="BotLeftOffset" v:prompt="" v:val="VT0(0):1"></v:ud>			<v:ud v:nameu="BotRightOffset" v:prompt="" v:val="VT0(0):1"></v:ud>			<v:ud v:nameu="visVersion" v:prompt="" v:val="VT0(15):26"></v:ud>		</v:userdefs>		<v:textblock v:margins="rect(4,4,4,4)"></v:textblock>		<v:textrect cx="12.375" cy="399.844" width="24.77" height="11.8125"></v:textrect>		<path d="M0 405.75 L24.75 405.75 L24.75 399.84 L18.84 393.94 L0 393.94 L0 405.75 Z" class="st2"></path>		<text x="6.81" y="-397.44" transform="scale(1,-1)" class="st18" v:langid="2052"><v:paragraph v:horizalign="1"></v:paragraph><v:tablist></v:tablist>opt</text>		</g>	<g id="shape27-119" v:mid="27" v:groupcontext="shape" transform="translate(32.25,626.25) scale(1,-1)">		<title>shape27-113</title>		<desc>loop</desc>		<v:userdefs>			<v:ud v:nameu="CTypeTopLeftSnip" v:prompt="" v:val="VT0(0):5"></v:ud>			<v:ud v:nameu="CTypeTopRightSnip" v:prompt="" v:val="VT0(1):5"></v:ud>			<v:ud v:nameu="CTypeBotLeftSnip" v:prompt="" v:val="VT0(1):5"></v:ud>			<v:ud v:nameu="CTypeBotRightSnip" v:prompt="" v:val="VT0(0):5"></v:ud>			<v:ud v:nameu="CornerLockHoriz" v:prompt="" v:val="VT0(0):5"></v:ud>			<v:ud v:nameu="CornerLockVert" v:prompt="" v:val="VT0(0):5"></v:ud>			<v:ud v:nameu="CornerLockDiag" v:prompt="" v:val="VT0(0):5"></v:ud>			<v:ud v:nameu="TopLeftOffset" v:prompt="" v:val="VT0(0):1"></v:ud>			<v:ud v:nameu="TopRightOffset" v:prompt="" v:val="VT0(0):26"></v:ud>			<v:ud v:nameu="BotLeftOffset" v:prompt="" v:val="VT0(0):1"></v:ud>			<v:ud v:nameu="BotRightOffset" v:prompt="" v:val="VT0(0):1"></v:ud>			<v:ud v:nameu="visVersion" v:prompt="" v:val="VT0(15):26"></v:ud>		</v:userdefs>		<v:textblock v:margins="rect(4,4,4,4)"></v:textblock>		<v:textrect cx="14.625" cy="399.422" width="29.27" height="12.6562"></v:textrect>		<path d="M0 405.75 L29.25 405.75 L29.25 399.42 L22.92 393.09 L0 393.09 L0 405.75 Z" class="st2"></path>		<text x="7.06" y="-397.02" transform="scale(1,-1)" class="st18" v:langid="2052"><v:paragraph v:horizalign="1"></v:paragraph><v:tablist></v:tablist>loop</text>		</g>	<g id="shape28-122" v:mid="28" v:groupcontext="shape" transform="translate(50.5,-262.25)">		<title>shape28-116</title>		<desc>[perSUID]</desc>		<v:userdefs></v:userdefs>		<v:textblock v:margins="rect(4,4,4,4)"></v:textblock>		<v:textrect cx="22.25" cy="400.687" width="44.53" height="10.125"></v:textrect>		<rect x="0" y="395.625" width="44.5" height="10.125" class="st17"></rect>		<text x="4.69" y="403.09" class="st18" v:langid="2052"><v:paragraph v:horizalign="1"></v:paragraph><v:tablist></v:tablist>[perSUID]</text>		</g>	<g id="shape29-125" v:mid="29" v:groupcontext="shape" transform="translate(59.25,-173.859)">		<title>shape29-119</title>		<desc>[sensorEvent]</desc>		<v:userdefs></v:userdefs>		<v:textblock v:margins="rect(4,4,4,4)"></v:textblock>		<v:textrect cx="29.25" cy="400.687" width="58.52" height="10.125"></v:textrect>		<rect x="0" y="395.625" width="58.5" height="10.125" class="st17"></rect>		<text x="4.79" y="403.09" class="st18" v:langid="2052"><v:paragraph v:horizalign="1"></v:paragraph><v:tablist></v:tablist>[sensorEvent]</text>		</g>	<g id="shape30-128" v:mid="30" v:groupcontext="shape" transform="translate(114.3,-65.25)">		<title>shape20-68</title>		<v:userdefs>			<v:ud v:nameu="TextPos" v:val="VT0(2):26"></v:ud>			<v:ud v:nameu="Scale" v:val="VT0(1):26"></v:ud>			<v:ud v:nameu="AntiScale" v:val="VT0(1):26"></v:ud>			<v:ud v:nameu="visVersion" v:val="VT0(15):26"></v:ud>			<v:ud v:nameu="msvDisableCustomConnectionPoints" v:prompt="" v:val="VT0(1):5"></v:ud>		</v:userdefs>		<path d="M0 392.25 L31.95 392.25 A6.75 6.75 0 0 1 38.7 399 A6.75 6.75 0 0 1 31.95 405.75 L6.16 405.75 L6.16 405.75" class="st19"></path>	</g></g>
</svg>

**图：QSH 客户端 API 工作流程**

以下列表描述了 QSH 客户端 API：

- `getSession()`：要与 QSH 交互，传感器应用客户端必须通过调用 `getSession()` API 创建接口会话。如果成功创建接口会话，则会向客户端返回 `ISession*` 对象。
- `open()`、`close()`、`setCallback()` 和 `sendRequest()`：使用 `getSession()` API 创建的接口以 *once\_per\_session* 为基础运行。此接口允许客户端应用程序使用 QSH 客户端 API，例如 `open()`、`close()`、`setCallback()` 和 `sendRequest()`，直到使用 `close()` 和 `delete()` API 显式删除会话。

    建立接口会话后，客户端应用程序或客户端代码可通过调用 `open()` API 来打开传感器会话。与 `getSession()` 类似，`open()` API 也是在 *once\_per\_session* 基础上调用。对于指定的 SUID，会调用一次 `setCallback()` 和 `sendRequest()` API。

### 消息

传感器客户端应用发送和接收以下请求与响应消息：

1. 通过 `sendRequest()` API 发送 `sns_client_request_msg` 请求消息。

    - 此消息的唯一字段是净荷，它是一个不透明的字节数组。该字段由协议缓存编码的 `sns_client_request_msg` 消息填充。
2. 收到 `sns_client_resp_msg` 响应消息。

    - 客户端管理器确定 `sns_client_request_msg` 消息是否已相应编码以及目标 SUID 是否可用。对请求执行最少量的处理。
    - 客户端管理器在收到请求后立即发送此响应消息。
3. 接收 `sns_client_event_msg` 消息类型的一个或多个事件。

    - 事件回调函数按照 `setCallback` API 中的规定接收事件消息。
    - 每个事件消息都有一个 SUID。
    - 事件消息可能包含一个或多个逻辑传感器示例，这些示例都编码在单个 `sns_client_event_msg` 消息中。

### 协议缓存

QSH 客户端请求和事件消息是包含协议缓存编码消息的不透明内存缓冲区。客户端可以用多种编程语言生成这些消息，然后将编码的字节数据流复制到 `sns_client_request_msg` 消息中。同样，客户端可以从 `sns_client_report_ind_msg` 消息中复制编码的消息并单独对其进行解码。

有关协议缓存的更多信息，请参阅[协议缓存](https://developers.google.com/protocol-buffers/)和 [nanopb](https://github.com/nanopb/nanopb)。

### 客户端管理器

传感器客户端管理器位于 QSH 内，负责监督所有通信过程并履行以下责任：

#### 转换传入请求

> 
> 
> 客户端管理器接收传入请求并将其转换为 QSH 可以理解的格式。转换涉及将请求转换为特定的请求消息。

#### 转换传出指示

> 
> 
> 客户端管理器在收到来自 QSH 的事件消息时，将其转换为传出指示。通过转换可确保消息的格式在 QSH 外部可理解。

#### 保证批处理选项

> 
> 
> 如果客户端指定了某些批量处理选项，则客户端管理器会确保这些选项得以满足。它检查数据是否以客户端指定的方式分组和发送。
> 
> 
> 关于客户端管理器的更多信息，请参阅 `<workspace>/build-qcom-wayland/workspace/sources/sensinghub/sensing-hub/apis/proto/sns_client.proto` 文件。

#### SUID

> 
> 
> SUID 是一个整数，用于唯一标识 QSH 提供的单个传感器。客户端将此 ID 视为启动期间随机生成的值。客户端不会假定 ID 重复或从数字本身派生任何信息。客户端管理器从请求中读取 SUID，并将请求路由到由 SUID 标识的传感器。
> 
> 
> 例如，如果 QSH 有两种引力算法可用，则每种算法都有自己唯一的 SUID。这种唯一的 ID 分配方式同样适用于物理传感器。如果物理传感器模型的硬件在设备上多次存在，则每个硬件都有自己的 SUID。
> 
> 
> 有关系统上可用传感器的完整列表，客户端可以向 SUID 传感器发送请求。关于更多详细信息，请参阅[表：平台传感器](https://docs.qualcomm.com/doc/80-70022-7SC/topic/architecture.html#table-platform-sensors)。

#### 客户端请求

> 
> 
> 客户端管理器的所有传入请求均使用 `sns_client_request_msg` 作为最外面的协议缓存消息。此消息包含以下字段：
> 
> - SUID：用作请求消息的目标地址。所有请求消息均发送到有效的 SUID 进行处理；否则，客户端管理器将拒绝这些消息。
> - msg\_id：`sns_std_request::payload` 消息中所包含的已编码请求的数字标识符。
> 
> 
>     例如，传感器可以支持请求消息，以启用流传输并启动数据刷新请求。这两条消息的格式不同，此字段指示目标传感器如何解释请求。消息 ID 在传感器支持的所有消息中始终是唯一的。但是，两个不同的传感器可能会对不同的消息类型使用特定的 ID。例如，以下是两种类型的消息：
> 
>     - `SNS_STD_SENSOR_MSGID_SNS_STD_SENSOR_CONFIG`：表示从客户端到传感器的标准流传输请求。
>     - `SNS_STD_SENSOR_MSGID_SNS_STD_SENSOR_EVENT`：表示来自数据源传感器的标准传感器事件。
> - 请求：是客户端发送到传感器的信息包。其中包含传感器所需的所有详细信息。`sns_std_request::payload` 字段对应于消息 ID 并且具有特定于传感器的配置。如需了解更多信息，请参阅特定于传感器的 proto 文件。
> - 重采样器配置：在客户端想要更改传感器对数据进行采样的速率时使用。使用以下选项进行重采样器配置：
> 
>     - `SNS_RESAMPLER_RATE_FIXED`：客户端需要以特定速率提供数据。例如，如果客户端希望以 200 Hz 的频率获取数据，而物理传感器支持以 240 Hz 的频率进行数据流传输，则以 200 Hz 的频率发送示例。
>     - `SNS_RESAMPLER_RATE_MINIMUM`：客户端希望以一定的最低速率提供数据。例如，如果客户端希望以 200 Hz 的频率获取数据，而物理传感器支持以 240 Hz 的频率进行数据流传输，则以 240 Hz 的频率发送示例。
> - 阈值配置：当客户端仅在满足特定条件的情况下才需要数据时使用。共有四个种类型的条件：
> 
>     - `SNS_THRESHOLD_TYPE_RELATIVE_VALUE` 提供的阈值，是当前值与上次报告的超出配置阈值的值这二者之间的差值。
>     - `SNS_THRESHOLD_TYPE_RELATIVE_PERCENT` 基于当前值与上一次报告值之间的差值提供阈值。它是上一次报告值的百分比，该百分比代表配置的阈值。
>     - `SNS_THRESHOLD_TYPE_ABSOLUTE` 提供的阈值是固定配置的值。
>     - `SNS_THRESHOLD_TYPE_ANGLE` 提供的阈值是四元数传感器的电流与上次报告的四元数之间夹角（以弧度为单位）。
> - 挂起配置：指定处理器挂起时系统的行为方式。
> 
>     - `client_proc_type` 是客户端所在的处理器。如果此处理器上的任何客户端请求刷新（完全发送数据），则该处理器上的所有客户端都将获得刷新数据。
>     - `delivery_type` 是关于处理器挂起时是否发送事件的配置项。
> 
>         - `SNS_STD_DELIVERY_WAKEUP`：每当事件可用时（以采样率或批处理周期）发送事件。如果请求的 `batch_period` 大于系统容量，则在容量耗尽时发送所有数据。启用此选项后，由于未发送的批量数据无法在缓存累积，因此 `flush_period` 将被有效忽略。
>         - `SNS_STD_DELIVERY_NO_WAKEUP`：仅当客户端处理器未挂起时才发送事件；否则，将数据批处理到刷新期为止。目标处理器退出挂起状态后，将发送所有挂起的事件。
>     - `nowakeup_msg_ids` 是不会唤醒客户端处理器的消息 ID 列表。所述消息 ID 不具备唤醒能力。仅当存在其他具备唤醒能力的事件时，才会发送这些消息 ID。
> 
> 
> 
>     有关详细信息，请参阅 `<workspace>/build-qcom-wayland/workspace/sources/sensinghub/sensing-hub/apis/proto/sns_client.proto` 文件。此处，`<workspace>` 指定了您的工作目录。

#### 批处理

> 
> 
> 在 `sns_client_request_msg::sns_std_request` 消息中，客户端可以指定接收请求数据的方式和时间。`sns_std_request` 消息包含以下字段：
> 
> - `batching::batch_period`：一个无符号整数值，表示批处理时间（以微秒为单位）。客户端可以假定已为给定的 `batch_period` 注册了一个定时器。自上次定时器过期到下一次定时器触发之前所生成的所有事件都将保存。此周期将被解释为客户端指定的最大周期。在某些并发场景下，事件会以更快的速率（更短的批处理周期）传递给客户端。客户端可以随时发送刷新请求，以指示客户端管理器发送所有批处理数据。默认情况下，批处理处于禁用状态。
> - `batching::flush_period`：无符号整数值，以微秒为单位。如果数据未发送到客户端，此字段会向客户端管理器或物理传感器提供有关必须批处理的历史数据量的提示。换言之，客户端管理器可能会以微秒为单位删除早于 `flush_period` 的数据。由于系统内存限制，有效刷新周期可能较小，在并发情况下可能较长。此字段是可选的，如果未设置，则默认为 `batch_period`，即仅保留一批数据。如果设置了该字段，则 `flush_period` 必须大于或等于 `batch_period`。
> - `batching::flush_only`：如果设置为 `True`，则客户端管理器仅在客户端发起刷新时发送事件。否则，它会继续批处理，直至达到 `flush_period` 为止（此时批处理将继续，但最旧的数据将被丢弃）。
> - `batching::max_batch`：如果设置为 `True`，它将引导传感器以最大批处理容量运行。如果请求同时具有 `flush_only = true` 和 `max_batch = true`，则 `flush_only` 优先。

#### 客户端事件

> 
> 
> 来自客户端管理器的所有传出指示均使用 `sns_client_event_msg` 作为位于 `sns_client_report_ind_msg` 的净荷字段内的最外层协议缓存编码消息。`sns_client_event_msg` 消息包含多个字段：
> 
> - SUID：与数据源事件关联。如果客户端向单个连接上的多个 SUID 发送请求，则此消息仅包含一个 SUID 的事件。来自其他 SUID 的事件在单独的指示消息中传递。
> - `events::msg_id`：唯一标识关联的事件消息。
> - `events::timestamp`：与该事件相关联的基于 QTimer 时钟计时单位的时间戳。对于大多数事件，传感器会设置时间戳，该时间戳是指在传感器硬件中创建物理示例的时间。对于框架生成的事件（如配置更新或错误事件），此时间戳是指创建事件的时间。
> - `events::payload`：动态长度净荷，包含来自传感器的实际数据/事件。使用特定于传感器的 proto 缓存单独解码此净荷。

#### 消息净荷

> 
> 
> 传感器特定的请求或事件在 `sns_client_request_msg::sns_std_request::payload` 和 `sns_client_event_msg::sns_client_event::payload` 消息中提及。这些消息字段可能包含协议缓存编码的消息，其字段特定于该消息 ID，或者可能为空，并且没有字段。
> 
> 
> 客户端使用与其通信的传感器关联的 `proto` 文件。每种传感器类型均有相应的 `proto` 文件。例如，`sns_accel.proto` 描述了如何启用加速计流。每个传感器都会发布其 `proto` 文件列表作为其属性的一部分。如需了解更多信息，请参阅[传感器属性](https://docs.qualcomm.com/doc/80-70022-7SC/topic/develop_sensors.html##table-sensor-attribute)。
> 
> - 数据类型：每个传感器均会通告一个数据类型属性。每种数据类型都与一组唯一的 `proto` 文件相关联，这些文件构成了该传感器专有 API。所有相同类型的传感器必须支持一组最少的请求和事件消息。它们可以定义和使用更多的该传感器专有的可选消息。每个传感器都会发布其 `proto` 文件的完整列表作为其属性的一部分。
> - 标准化消息：任何客户端均可向任意传感器发送一组 Qualcomm 定义的标准化消息。这些消息在 `sns_std.proto` 文件中定义。
> 
>     - `SNS_STD_MSGID_SNS_STD_ATTR_REQ`：查询传感器的属性列表。它会返回一个具有 `SNS_STD_MSGID_SNS_STD_ATTR_EVENT` ID 的事件，该事件包含所有已发布属性的列表，请参阅[传感器属性](https://docs.qualcomm.com/doc/80-70022-7SC/topic/develop_sensors.html##table-sensor-attribute)。客户端还可以在发布新属性或更新属性时注册通知。
> 
>         - `sns_std_attr_req` 包含 `register_updates` 字段。如果设置为 `True`，则每当传感器属性发生更改时，客户端都会通过 `sns_std_attr_event` 收到通知。
>         - `sns_std_attr_event` 包含 `attributes` 字段，该字段列出了传感器为响应 `sns_std_attr_req` 而发送的传感器发布的所有属性，或在对已注册传感器的属性更改时发布的所有属性。
>     - `SNS_STD_MSGID_SNS_STD_FLUSH_REQ`：强制立即将来自此传感器的所有批处理数据发送到客户端。此请求消息强制系统上适用的硬件和软件缓存刷新所有存在的数据。
> 
> 
>         例如，向加速度计传感器发送此请求会触发物理先进先出 (FIFO) 刷新，以及客户端管理器当前持有的任何样本。如果刷新请求是针对内部使用加速度计和陀螺仪数据的算法（例如游戏旋转矢量 (GRV)），则加速度计和陀螺仪硬件 FIFO 都会刷新。
>     - `SNS_CLIENT_MSGID_SNS_CLIENT_DISABLE_REQ`：禁用此传感器的活动请求。例如，客户端向加速度计传感器发送 `SNS_STD_SENSOR_MSGID_SNS_STD_SENSOR_CONFIG` 消息以启用数据流动。稍后，发送 `DISABLE_REQ` 将取消数据流请求，并且此客户端的加速计数据流将停止。
>     - `SNS_STD_MSGID_SNS_STD_FLUSH–EVENT`：对刷新请求的响应。它表示没有与刷新请求对应的其他事件。
>     - `SNS_STD_MSGID_SNS_STD_ERROR–EVENT`：由传感器、传感器实例或框架生成的错误事件。
> 
> 
>         有关详细信息，请参阅 `<workspace>/build-qcom-wayland/workspace/sources/sensinghub/sensing-hub/apis/proto/sns_client.proto` 文件。
> - 标准化传感器消息：客户端请求中描述的消息适用于所有传感器。除了客户端请求中所描述的消息之外，还可以使用 Qualcomm 推荐的标准化消息。这些建议是可选的，您可以选择定义自己的请求和事件消息。
> 
>     - `SNS_STD_SENSOR_MSGID_SNS_STD_SENSOR_CONFIG`：允许以下情况进行流传输的请求消息：
> 
>         - 任何物理传感器，例如加速度计、陀螺仪和地磁传感器。
>         - 部分算法，例如旋转矢量、重力和线性加速度。
>     - `SNS_STD_SENSOR_MSGID_SNS_STD_ON_CHANGE_CONFIG`：请求允许对更改类型传感器进行流传输的消息。例如，接近度、环境光和步进检测传感器。
>     - `SNS_STD_SENSOR_MSGID_SNS_STD_SENSOR_PHYSICAL_CONFIG_EVENT`：处理客户端请求后所有物理传感器发送的事件。它指示数据流客户端的期望，例如传感器生成示例的速率。
>     - `SNS_STD_SENSOR_MSGID_SNS_STD_SENSOR_EVENT`：根据客户请求，传感器产生的数据样本。
> 
> 
> 
>     有关详细信息，请参阅 `sns_std_sensor.proto` 文件。
> - SUID 查找传感器：客户端可以在 SUID 查找传感器中查询与特定数据类型关联的 SUID 列表。`sns_suid_req` 消息指定数据类型，客户端接收所有匹配的 SUID。空数据类型字符串会导致接收系统上所有 SUID。
> 
> 
>     例如，如果客户端将 *accel* 指定为数据类型，则客户端会收到其传感器提供 *accel* 类型数据的所有 SUID 的列表。此外，如果客户端希望接收新匹配项的通知，则可以通过 `register_updates` 字段来表明这一需求。客户端可以在 `sns_suid_req` 消息之后发送一个属性请求 (`sns_std_attr_req`)，以决定哪些可用的*加速度*传感器适合该客户端。
> 
> 
>     SUID 查找传感器具有自己的 SUID，该 SUID 是常量并发布在 `sns_suid.proto` 文件中（在所有其他传感器中保持唯一）。
> 
> 
>     `sns_suid_req` 消息包含以下字段。有关更多信息，请参阅 `sns_suid.proto` 文件和示例代码。
> 
> 
> 
> 表：SUID 请求
> 
> 
>     | 字段 | 强制或可选 | 数据类型 | 说明 |
>     | --- | --- | --- | --- |
>     | `data_type` | 必选 | 字符串 | 要查询 SUID 的传感器的数据类型。 |
>     | `register_updates` | 可选 | Boolean | 注册以获取更新，了解公布 `data_type` 字段的 SUID 列表。 |
>     | `default_only` | 可选 | Boolean | 可以通过注册表为每种数据类型配置一个默认传感器。<br><br><br><br>> <br>> <br>> <ul class="simple"><br>> <li><p>如果 <code class="docutils literal notranslate"><span class="pre">default_only</span></code> 字段设置为 True，且：</p><ul><br>> <li><p>显式配置了数据类型的默认值，则仅通过 SUID 事件发送默认的传感器 SUID（如有）。</p></li><br>> <li><p>未显式配置数据类型的默认值，则通过 SUID 事件发送数据类型相匹配的第一个传感器的 SUID。</p></li><br>> </ul><br>> </li><br>> <li><p>如果 <code class="docutils literal notranslate"><span class="pre">default_only</span></code> 字段设置为 False，则数据类型匹配的所有传感器都将在可用时发送。</p></li><br>> </ul> |

#### 传感器属性

> 
> 
> 每个传感器都会发布一个属性列表，每个属性由一个数字标识符表示。这些属性提供有关传感器功能及其接受作为输入的值范围的信息。下表列出了几个重要属性：

> 
> 
> > 
> > 
> > 表：传感器属性
> > 
> > 
> > | 属性 ID | 属性名称 | 必需？ | 数据类型 | 说明 |
> > | --- | --- | --- | --- | --- |
> > | 0 | `SNS_STD_SENSOR_ATTRID_NAME` | 是 | 字符串 | 易读的传感器名称。 |
> > | 1 | `SNS_STD_SENSOR_ATTRID_VENDOR` | 是 | 字符串 | 易读的供应商名称。 |
> > | 2 | `SNS_STD_SENSOR_ATTRID_TYPE` | 是 | 字符串 | 传感器 proto 文件中所定义的供此传感器使用的数据类型。 |
> > | 3 | `SNS_STD_SENSOR_ATTRID_AVAILABLE` | 是 | Boolean | 指示此传感器是否可用于客户端。 |
> > | 4 | `SNS_STD_SENSOR_ATTRID_VERSION` | 是 | 整型 | <ul class="simple"><br><li><p>64 位整数值以 <code class="docutils literal notranslate"><span class="pre">major[31:16].minor[15:8].revision[7:0]</span></code> 呈现，用于表示传感器的版本。</p></li><br><li><p>十六进制示例：major：0x0002 minor：0x00 revision：0x36。</p></li><br><li><p>DRIVER_VERSION 0x00020036。</p></li><br></ul> |
> > | 5 | `SNS_STD_SENSOR_ATTRID_API` | 是 | 字符串 | 列出该传感器使用的各个 `proto` 文件名；更多 `proto` 依赖项可以在同一个 proto 文件中指定为导入项，以用于自动化测试的目的。 |
> > | 6 | `SNS_STD_SENSOR_ATTRID_RATES` | 否 | 浮点 | 传感器支持的采样率。 |
> > | 7 | `SNS_STD_SENSOR_ATTRID_RESOLUTIONS` | 否 | 浮点 | 传感器支持的样品分辨率。 |
> > | 8 | `SNS_STD_SENSOR_ATTRID_FIFO_SIZE` | 否 | 整型 | 支持的 FIFO 深度（示例数）。 |
> > | 9 | `SNS_STD_SENSOR_ATTRID_ACTIVE_CURRENT` | 否 | 整型 | 有源电流阵列（以 μA 为单位）。 |
> > | 10 | `SNS_STD_SENSOR_ATTRID_SLEEP_CURRENT` | 否 | 整型 | 非活动电流（以 μA 为单位）。 |
> > | 11 | `SNS_STD_SENSOR_ATTRID_RANGES` | 否 | 浮点 | 传感器支持的工作范围。 |
> > | 12 | `SNS_STD_SENSOR_ATTRID_OP_MODES` | 否 | 字符串 | 定义传感器支持的操作模式。例如，[LPM, HIGH\_PERF, NORMAL, OFF]. |
> > | 13 | `SNS_STD_SENSOR_ATTRID_DRI` | 否 | Boolean | 表示传感器是支持数据就绪中断 (DRI) 还是带内中断 (IBI)：<br><br><br><br>> <br>> <br>> <ul class="simple"><br>> <li><p>True = DRI</p></li><br>> <li><p>False = IBI</p></li><br>> </ul> |
> > | 14 | `SNS_STD_SENSOR_ATTRID_STREAM_SYNC` | 否 | Boolean | 表示传感器是否支持同步数据流。 |
> > | 15 | `SNS_STD_SENSOR_ATTRID_EVENT_SIZE` | 否 | 整型 | <ul class="simple"><br><li><p>此传感器生成的数据事件（协议缓冲区编码）的大小（以字节为单位）。</p></li><br><li><p>对于物理和虚拟传感器，此值是指其传感器示例的大小</p></li><br><li><p>供硬件抽象层 (HAL) 用于确定最大批处理容量。</p></li><br></ul> |
> > | 16 | `SNS_STD_SENSOR_ATTRID_STREAM_TYPE` | 是 | 整型 | 表示传感器支持的流传输类型：<br><br><br><br>> <br>> <br>> <ul class="simple"><br>> <li><p>0 = 连续定期采样</p></li><br>> <li><p>1 = 更改时</p></li><br>> <li><p>2 = 单路输出（单次）</p></li><br>> </ul> |
> > | 17 | `SNS_STD_SENSOR_ATTRID_DYNAMIC` | 否 | Boolean | 指定此传感器是否为动态（在运行时连接或断开）。 |
> > | 18 | `SNS_STD_SENSOR_ATTRID_HW_ID` | 否 | 整型 | 区分同一硬件的多个传感器。 |
> > | 19 | `SNS_STD_SENSOR_ATTRID_RIGID_BODY` | 否 | 整型 | 放置传感器的刚体。<br><br><br><br>> <br>> <br>> <ul class="simple"><br>> <li><p>0 = 传感器硬件位于显示屏侧</p></li><br>> <li><p>1 = 传感器硬件位于键盘侧</p></li><br>> <li><p>2 = 传感器硬件安装在外部设备上</p></li><br>> </ul> |
> > | 21 | `SNS_STD_SENSOR_ATTRID_PHYSICAL_SENSOR` | 否 | Boolean | <ul class="simple"><br><li><p>如果是物理传感器，则为 <code class="docutils literal notranslate"><span class="pre">True</span></code>。</p></li><br><li><p>如果是虚拟传感器，则为 <code class="docutils literal notranslate"><span class="pre">False</span></code>。</p></li><br></ul> |
> > | 22 | `SNS_STD_SENSOR_ATTRID_PHYSICAL_SENSOR_TESTS` | 否 | 整型 | 使用 `sns_physical_sensor_test_type` 中的枚举值表示支持的物理传感器测试。 |
> > | 23 | `SNS_STD_SENSOR_ATTRID_SELECTED_RESOLUTION` | 否 | 浮点 | 每个动态范围值的测量分辨率。 |
> > | 24 | `SNS_STD_SENSOR_ATTRID_SELECTED_RANGE` | 否 | Float[2] | 传感器支持的动态范围选项。对于默认选项，请参阅供应商的传感器硬件要求规范。 |
> > | 25 | `SNS_STD_SENSOR_ATTRID_ADDITIONAL_LOW_LATENCY_RATES` | 否 | 浮点 | 低延迟操作的其他采样率，以 Hz 为单位。这些采样率适用于专用的低延迟客户端，扩展了 `SNS_STD_SENSOR_ATTRID_RATES` 属性中发布的速率。<br><br><br>专用内部客户端必须使用这些更高的数据传输速率，因为它们可能会影响系统性能。 |
> > | 26 | `SNS_STD_SENSOR_ATTRID_PASSIVE_REQUEST` | 否 | Boolean | 如果传感器支持被动请求，则为 `True`；否则为 `False`。如果传感器不支持被动请求，则必须将所有请求视为主动请求。 |
> > | 29 | `SNS_STD_SENSOR_ATTRID_TRANSPORT_MTU_SIZE` | 否 | 整型 | 传输传感器的最大传输单元 (MTU) 大小（以字节为单位）。 |
> > | 30 | `SNS_STD_SENSOR_ATTRID_HLOS_INCOMPATIBLE` | 否 | Boolean | 如果传感器与支持的数据类型的高级操作系统 (HLOS) 规范不兼容，则为 `True`。 |
> > | 31 | `SNS_STD_SENSOR_ATTRID_SERIAL_NUM` | 否 | 字符串 | 传感器序列号。 |
> > | 32 | `SNS_STD_SENSOR_ATTRID_TECH_USED` | 否 | 整数数组 | 使用的技术列表。如需了解更多信息，请参阅 `sns_std_type.proto` 文件中的 `sns_tech`。 |
> 
> 
> 
> 有关更多信息，请参阅 `sns_std_sensor.proto` 文件和示例代码。Proto 文件位于设备上的 `/etc/sensors/proto/` 目录中。

- [使用 QSH 客户端 API 开发应用程序](https://docs.qualcomm.com/doc/80-70022-7SC/topic/sample1.html)
- [配置传感器](https://docs.qualcomm.com/doc/80-70022-7SC/topic/sample1.html#id1)
- [开发并集成传感器驱动程序](https://docs.qualcomm.com/doc/80-70022-7SC/topic/sample1.html#id2)
- [开发并集成自定义传感器算法](https://docs.qualcomm.com/doc/80-70022-7SC/topic/sample1.html#id3)
- [校准传感器](https://docs.qualcomm.com/doc/80-70022-7SC/topic/calibrate.html)

Last Published: Nov 03, 2025

[Previous Topic
调通传感器](https://docs.qualcomm.com/bundle/publicresource/80-70022-7SC/topics/bringup_sensors.md) [Next Topic
使用 QSH 客户端 API 开发应用程序](https://docs.qualcomm.com/bundle/publicresource/80-70022-7SC/topics/sample1.md)