{"id":36336,"date":"2024-11-26T17:47:17","date_gmt":"2024-11-26T09:47:17","guid":{"rendered":"https:\/\/fwq.ai\/blog\/36336\/"},"modified":"2024-11-26T17:47:17","modified_gmt":"2024-11-26T09:47:17","slug":"%e4%b8%b2%e5%8f%a3%e6%8e%a5%e6%94%b6%e6%95%b0%e6%8d%ae%e6%97%b6%ef%bc%8c%e4%b8%ba%e4%bb%80%e4%b9%88%e6%8e%a5%e6%94%b6%e5%87%bd%e6%95%b0%e6%97%a0%e6%b3%95%e6%94%b6%e5%88%b0%e9%a2%84%e6%9c%9f%e5%93%8d","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/36336\/","title":{"rendered":"\u4e32\u53e3\u63a5\u6536\u6570\u636e\u65f6\uff0c\u4e3a\u4ec0\u4e48\u63a5\u6536\u51fd\u6570\u65e0\u6cd5\u6536\u5230\u9884\u671f\u54cd\u5e94\u6570\u636e\uff1f"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/001\/246\/273\/173111063543102.jpg\" class=\"aligncenter\" title=\"\u4e32\u53e3\u63a5\u6536\u6570\u636e\u65f6\uff0c\u4e3a\u4ec0\u4e48\u63a5\u6536\u51fd\u6570\u65e0\u6cd5\u6536\u5230\u9884\u671f\u54cd\u5e94\u6570\u636e\uff1f\u63d2\u56fe\" alt=\"\u4e32\u53e3\u63a5\u6536\u6570\u636e\u65f6\uff0c\u4e3a\u4ec0\u4e48\u63a5\u6536\u51fd\u6570\u65e0\u6cd5\u6536\u5230\u9884\u671f\u54cd\u5e94\u6570\u636e\uff1f\u63d2\u56fe\" \/><\/p>\n<p><strong>\u4e32\u53e3\u63a5\u6536\u6570\u636e\u65f6\u7684\u7591\u60d1\u89e3\u7b54<\/strong><\/p>\n<p>\u5173\u4e8e\u4e32\u53e3\u901a\u4fe1\u4e2d\u6570\u636e\u63a5\u6536\u7684\u95ee\u9898\uff0c\u4ee5\u4e0b\u5217\u51fa\u5177\u4f53\u539f\u56e0\u548c\u89e3\u51b3\u65b9\u6848\uff1a<\/p>\n<p><strong>\u95ee\u9898\uff1a<\/strong><\/p>\n<p>\u5f53\u53d1\u9001\u7279\u5b9a\u547d\u4ee4\uff08\u5982\u201csendo2zero\u201d\uff09\u540e\uff0c\u63a5\u6536\u51fd\u6570 ondatareceive \u6ca1\u6709\u6536\u5230\u9884\u671f\u7684\u54cd\u5e94\u6570\u636e\uff0c\u5bfc\u81f4 mnactivity.setgaszero3 \u4e3a\u7a7a\u3002<\/p>\n<p><strong>\u539f\u56e0\uff1a<\/strong><\/p>\n<p>\u53d1\u9001\u547d\u4ee4\u540e\uff0c\u4e32\u53e3\u4e2d\u7ee7\u5668\u9700\u8981\u4e00\u5b9a\u65f6\u95f4\u6765\u5904\u7406\u6570\u636e\u3002\u5982\u679c\u5728\u6570\u636e\u5230\u8fbe\u63a5\u6536\u51fd\u6570\u4e4b\u524d\u5c31\u8fdb\u884c\u540e\u7eed\u64cd\u4f5c\uff0c\u53ef\u80fd\u4f1a\u5bfc\u81f4\u63a5\u6536\u51fd\u6570\u672a\u80fd\u63a5\u6536\u5230\u6570\u636e\u3002<\/p>\n<p><strong>\u89e3\u51b3\u65b9\u6848\uff1a<\/strong><\/p>\n<p>\u5728 ondatareceive \u51fd\u6570\u4e2d\u6dfb\u52a0\u5ef6\u65f6\uff0c\u5141\u8bb8\u7f13\u51b2\u533a\u6709\u8db3\u591f\u7684\u65f6\u95f4\u63a5\u6536\u5168\u90e8\u6570\u636e\u3002\u5177\u4f53\u5b9e\u73b0\u5982\u4e0b\uff1a<\/p>\n<pre>public void onDataReceive(byte[] bytes, int i) {\n    if (bytes != null &amp;&amp; bytes.length != 0) {\n        if (bytes[0] == 1 &amp;&amp; bytes[1] == 3) {\n            Thread.sleep(100); \/\/ \u5ef6\u65f6100\u6beb\u79d2\n            MainActivity.setGaszero = bytes;\n        }\n    }\n}<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u901a\u8fc7\u6dfb\u52a0\u5ef6\u65f6\uff0c\u5e94\u7528\u7a0b\u5e8f\u5c06\u7b49\u5f85\u4e00\u5b9a\u65f6\u95f4\uff0c\u76f4\u5230\u4e32\u53e3\u7f13\u51b2\u533a\u63a5\u6536\u5230\u6240\u6709\u6570\u636e\uff0c\u4ece\u800c\u786e\u4fdd mainactivity.setgaszero3 \u80fd\u591f\u63a5\u6536\u5b8c\u6574\u7684\u6570\u636e\u3002<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u4e32\u53e3\u63a5\u6536\u6570\u636e\u65f6\uff0c\u63a5\u6536\u51fd\u6570\u65e0\u6cd5\u6536\u5230\u9884\u671f\u54cd\u5e94\u6570\u636e\uff1f\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4e32\u53e3\u63a5\u6536\u6570\u636e\u65f6\u7684\u7591\u60d1\u89e3\u7b54 \u5173\u4e8e\u4e32\u53e3\u901a\u4fe1\u4e2d\u6570\u636e\u63a5\u6536\u7684\u95ee\u9898\uff0c\u4ee5\u4e0b\u5217\u51fa\u5177\u4f53\u539f\u56e0\u548c\u89e3\u51b3\u65b9\u6848\uff1a \u95ee\u9898\uff1a \u5f53\u53d1\u9001\u7279\u5b9a\u547d\u4ee4\uff08\u5982\u201csendo2zero\u201d\uff09\u540e\uff0c\u63a5\u6536\u51fd\u6570 ondatareceive \u6ca1\u6709\u6536\u5230\u9884\u671f\u7684\u54cd\u5e94\u6570\u636e\uff0c\u5bfc\u81f4 mnactivity.setgaszero3 \u4e3a\u7a7a\u3002 \u539f\u56e0\uff1a \u53d1\u9001\u547d\u4ee4\u540e\uff0c\u4e32\u53e3\u4e2d\u7ee7\u5668\u9700\u8981\u4e00\u5b9a\u65f6\u95f4\u6765\u5904\u7406\u6570\u636e\u3002\u5982\u679c\u5728\u6570\u636e\u5230\u8fbe\u63a5\u6536\u51fd\u6570\u4e4b\u524d\u5c31\u8fdb\u884c\u540e\u7eed\u64cd\u4f5c\uff0c\u53ef\u80fd\u4f1a\u5bfc\u81f4\u63a5\u6536\u51fd\u6570\u672a\u80fd\u63a5\u6536\u5230\u6570\u636e\u3002 \u89e3\u51b3\u65b9\u6848\uff1a \u5728 ondatareceive \u51fd\u6570\u4e2d\u6dfb\u52a0\u5ef6\u65f6\uff0c\u5141\u8bb8\u7f13\u51b2\u533a\u6709\u8db3\u591f\u7684\u65f6\u95f4\u63a5\u6536\u5168\u90e8\u6570\u636e\u3002\u5177\u4f53\u5b9e\u73b0\u5982\u4e0b\uff1a public void onDataReceive(byte[] bytes, int i) { if (bytes != null &amp;&amp; bytes.length != 0) { if (bytes[0] == 1 &amp;&amp; bytes[1] == 3) { Thread.sleep(100); \/\/ \u5ef6\u65f6100\u6beb\u79d2 MainActivity.setGaszero = bytes; } } } \u767b\u5f55\u540e\u590d\u5236 \u901a\u8fc7\u6dfb\u52a0\u5ef6\u65f6\uff0c\u5e94\u7528\u7a0b\u5e8f\u5c06\u7b49\u5f85\u4e00\u5b9a\u65f6\u95f4\uff0c\u76f4\u5230\u4e32\u53e3\u7f13\u51b2\u533a\u63a5\u6536\u5230\u6240\u6709\u6570\u636e\uff0c\u4ece\u800c\u786e\u4fdd mainactivity.setgaszero3 \u80fd\u591f\u63a5\u6536\u5b8c\u6574\u7684\u6570\u636e\u3002 \u4ee5\u4e0a\u5c31\u662f\u4e32\u53e3\u63a5\u6536\u6570\u636e\u65f6\uff0c\u63a5\u6536\u51fd\u6570\u65e0\u6cd5\u6536\u5230\u9884\u671f\u54cd\u5e94\u6570\u636e\uff1f\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[],"class_list":["post-36336","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/36336","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=36336"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/36336\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=36336"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=36336"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=36336"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}