一个dvertising / Scan Response problems

2 posts / 0 new
Last post
michaelquicquaro
Offline
Last seen:5 years 2 months ago
加入:2014-09-26 14:40
一个dvertising / Scan Response problems

Hello,

I would like to do advertisements and scan responses with more information in the packets than as shown in the examples.

Do any of the examples have something more complicated that I can look at?
More specifically, I am trying to get an advertisement of the form:

// GAP - Advertisement data (max size = 31 bytes, though this is
// best kept short to conserve power while advertisting)
#define ADVERTISING_DATA_LENGTH 18
uint8 advertising_data[ADVERTISING_DATA_LENGTH] =
{
// Flags; this sets the device to use limited discoverable
// mode (advertises for 30 seconds at a time) instead of general
// discoverable mode (advertises indefinitely)
0x02, // length of this data
GAP_AD_TYPE_FLAGS,
GAP_LE_GEN_DISCOVERABLE_FLG | GAP_BR_EDR_NOT_SUPPORTED,

// service UUID, to notify central devices what services are included
// in this peripheral
0x11, // length of this data
GAP_AD_TYPE_MORE_128_BIT_UUID, // some of the UUID's, but not all
MY_SERVICE_UUID, // reverse order
};

It seems that when I try to use multiple pdu segments in the packet of the gapm_start_advertise_cmd I don't get any advertisements via LightBlue.

The same is true of the scan response data. It also seems the GAP_AD_TYPE_COMPLETE_NAME does not work.
Of the following, only "Attempt 3" will allow me to see advertisements with LightBlue.

// Attempt 1
// GAP - SCAN RSP data (max size = 31 bytes)
#define SCAN_RESPONSE_DATA_LENGTH 25
uint8 scan_response_data[SCAN_RESPONSE_DATA_LENGTH] =
{
// complete name
0 x0f, / /长度的数据
GAP_AD_TYPE_COMPLETE_NAME,
'T', // 'T'
'D', // 'D'
'L', // 'L'
' S ', / /“年代”
'-', // '-'
'A', // 'A'
'B', // 'B'
'C', // 'C'
'D', // 'D'
'E', // 'E'
'F', // 'F'
' ',
' ',
' ',

// connection interval range
0x05, // length of this data
GAP_AD_TYPE_SLAVE_CONN_INT_RANGE,
LO_UINT16( DEFAULT_DESIRED_MIN_CONN_INTERVAL ), // 100ms
HI_UINT16( DEFAULT_DESIRED_MIN_CONN_INTERVAL ),
LO_UINT16( DEFAULT_DESIRED_MAX_CONN_INTERVAL ), // 1s
HI_UINT16( DEFAULT_DESIRED_MAX_CONN_INTERVAL ),

// Tx power level
0x02, // length of this data
GAP_AD_TYPE_TRANSMIT_POWER,
0, // 0dBm
};

// Attempt 2
#define SCAN_RESPONSE_DATA_LENGTH 16
uint8 scan_response_data[SCAN_RESPONSE_DATA_LENGTH] =
{
// complete name
0 x0f, / /长度的数据
GAP_AD_TYPE_COMPLETE_NAME,
'T', // 'T'
'D', // 'D'
'L', // 'L'
' S ', / /“年代”
'-', // '-'
'A', // 'A'
'B', // 'B'
'C', // 'C'
'D', // 'D'
'E', // 'E'
'F', // 'F'
' ',
' ',
' ',
};

// Attempt 3
#define SCAN_RESPONSE_DATA_LENGTH 3
uint8 scan_response_data[SCAN_RESPONSE_DATA_LENGTH] =
{
// Tx power level
0x02, // length of this data
GAP_AD_TYPE_TRANSMIT_POWER,
0, // 0dBm
};

Can you please advise me. Is there a document that explains how to use gapm_start_advertise_cmd a little better, or perhaps a more in depth example?

Regards,
- Mike

michaelquicquaro
Offline
Last seen:5 years 2 months ago
加入:2014-09-26 14:40
I solved my issue. I was

I solved my issue. I was unaware of the stack assigning the first three bytes of the advertisement.