6 Replies Latest reply on Jun 3, 2014 11:31 AM by ArvindS_76

    Does peripheral ad data need to be ASCII text?

      Or, can the ad data be binary bytes.

      Obviously, more information can be packed into bytes than represented by ASCII text.

       

      What's the maximum ad size in bytes?

        • 1. Re: Does peripheral ad data need to be ASCII text?
          ArvindS_76

          > What's the maximum ad size in bytes?

          An advertisement packet is limited to 31 bytes by the spec.

           

          > can the ad data be binary bytes.

          There is a specific formatting requirement for the advertisement packet. See Bluetooth Specification, Volume 3, Part C (Generic Access Protocol), Section 11 (Advertising and scan response data format). There is also an example in 11.2.

           

          In summary:

           

           

          All valid AD Types are listed in the assigned numbers document (for GAP assigned numbers, see English Generic Access Profile). If you use a manufacturer specific data AD type, then the first two bytes of AD Data should be the company identifier, followed by any (including binary) data you want.

          • 2. Re: Does peripheral ad data need to be ASCII text?
            MichaelF_56

            There is some sample code which shows how to generate advertisement data in the hello_sensor and mybeacon applications.

            • 3. Re: Does peripheral ad data need to be ASCII text?

              Does there have to be at least one byte of insignificant data, or can significant data take up all 31 bytes of the ad?

              • 4. Re: Does peripheral ad data need to be ASCII text?
                ArvindS_76

                Significant data can take up all 31 bytes.

                • 5. Re: Does peripheral ad data need to be ASCII text?

                  So then, the maximum binary advertisement data would be 29 bytes:

                   

                  1 Length octet

                  1 AD Type octet = Mfg Specific Data

                  29 AD Data octets = any binary 29 bytes

                   

                  Will this work in SDK 2.x  ?

                  • 6. Re: Does peripheral ad data need to be ASCII text?
                    ArvindS_76

                    The Flags AD type is mandatory (BR/EDR is not supported by 2073x). So you have to include that in your advertisement data. From section 11.1.3 in Volume 3, Part C:

                     

                    11.1.3 Flags

                    The Flags AD type contains several flag bits interpreted as boolean values.

                    Flags used over the LE physical channel are:

                    • Limited Discoverable Mode

                    • General Discoverable Mode

                    • BR/EDR Not Supported

                    • Simultaneous LE and BR/EDR to Same Device Capable (Controller)

                    • Simultaneous LE and BR/EDR to Same Device Capable (Host)

                    The Flags AD type shall not be included in the scan response data. The advertising

                    data shall not contain more than one instance of the Flags AD type. The

                    Flags AD type shall be included in the advertising data if any of the bits are

                    non-zero. The Flags AD type may be omitted from the advertising data if all of

                    the bits are zero. The format of Flags AD type is defined in Table 18.1. [Emphasis added]



                    And from section 18.11, the manufacturer specific data should also include a 2 byte company identifier:

                     

                     

                    2 1 byte length (=2)

                    1 byte AD type = Flags (= 0x01)

                    1 byte Flags value

                    X 1 byte length (=X)

                    1 byte AD type = Manufacturer Specific Data (= 0xFF)

                    2 bytes Company identifier

                    X-3 bytes data

                     

                     

                    The max value of X will then be 26 27 and you can have 23 24 binary octets (X - 3 data bytes).

                     

                    [EDIT]: Updated some of the fields old values with new ones. Yes, this will work with SDK 1.1.0 and SDK 2.0.1.