菜鸟教程小白 发表于 2022-12-12 19:30:17

android - iOS 和 Android Max BLE 广告和扫描字节


                                            <p><p>我一直在通过stackoverflow搜索;但是,我似乎发现了有关此问题的各种相互矛盾的答案。给定 Android 5.1.1 和 iOS 8.4.1,可以通过无连接 BLE 服务相互发送的最大字节数是多少。我的基本理解是它应该是 BLE 规范的 20 个字节(实际上是 23 个字节);但是,我看到了 iOS 能够推送 512 并且 android 能够增加它的 MTU 的查询。 </p>

<p>此外,如果可以在连接中发送超过 20 个字节,那么当 iOS 和 android 上的跨平台应用程序在没有直接连接的情况下接收数据包时,它们是否都能被扫描仪正确识别? </p></p>
                                    <br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
                                            <p><p>根据 Apple 的 <a href="https://developer.apple.com/library/ios/documentation/NetworkingInternetWeb/Conceptual/CoreBluetooth_concepts/BestPracticesForSettingUpYourIOSDeviceAsAPeripheral/BestPracticesForSettingUpYourIOSDeviceAsAPeripheral.html" rel="noreferrer noopener nofollow">Best Practices for Setting Up Your Local Device as a Peripheral</a> :</p>

<blockquote>
<p>Although advertising packets in general can hold a variety of
information about the peripheral device, you may advertise only your
device’s local name and the UUIDs of any services you want to
advertise. That is, when you create your advertising dictionary, you
may specify only the following two keys:
CBAdvertisementDataLocalNameKey and
CBAdvertisementDataServiceUUIDsKey. You receive an error if you
specify any other keys.</p>

<p>There are also limits as to how much space you can use when
advertising data. When your app is in the foreground, it can use up to
28 bytes of space in the initial advertisement data for any
combination of the two supported advertising data keys. If this space
is used up, there are an additional 10 bytes of space in the scan
response that can be used only for the local name. Any service UUIDs
that do not fit in the allotted space are added to a special
“overflow” area; they can be discovered only by an iOS device that is
explicitly scanning for them. While your app is in the background, the
local name is not advertised and all service UUIDs are place in the
overflow area.</p>

<p><strong>Note:</strong> These sizes do not include the 2 bytes of header information
that are required for each new data type. The exact format of
advertising and response data is defined in the Bluetooth 4.0
specification, Volume 3, Part C, Section 11</p>
</blockquote>

<p>如果您使用未注册的 16 字节服务 UUID,我认为这将为您提供大约 12 字节的数据。</p>

<p>广告包中的可用字节与有效负载包中的可用字节不同。</p></p>
                                   
                                                <p style="font-size: 20px;">关于android - iOS 和 Android Max BLE 广告和扫描字节,我们在Stack Overflow上找到一个类似的问题:
                                                        <a href="https://stackoverflow.com/questions/36754682/" rel="noreferrer noopener nofollow" style="color: red;">
                                                                https://stackoverflow.com/questions/36754682/
                                                        </a>
                                                </p>
                                       
页: [1]
查看完整版本: android - iOS 和 Android Max BLE 广告和扫描字节