This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Tool/software: Code Composer Studio
I'm working with CC2650 LaunchPad and CC2650 MODA , at first I can use
GAPRole_SetParameter(GAPROLE_ADVERT_DATA, sizeof(broadcastData), broadcastData);
to change the advertisement data, it's work fine at first , but somehow it didn't work , I have reinstalled the ccs and simplelink SDK,
and let my project to the last worked version , but it still can't work.
I tried on the other computer it's work fine but the other computer had become the same situation, it bother me so much.
this is what I init my bluetooth code:
static void SimpleBLEBroadcaster_init(void) { ICall_registerApp(&selfEntity, &sem); // Hard code the DB Address till CC2650 board gets its own IEEE address // 強制設定 MacAddress // uint8 bdAddress[B_ADDR_LEN] = { 0x33, 0x33, 0x33, 0x33, 0x33, 0x33 }; // HCI_EXT_SetBDADDRCmd(bdAddress); appMsgQueue = Util_constructQueue(&appMsg); // Setup the GAP Broadcaster Role Profile { uint8_t initial_advertising_enable = TRUE; uint16_t gapRole_AdvertOffTime = 0; uint8_t advType = GAP_ADTYPE_ADV_NONCONN_IND; // use non-connectable adv GAPRole_SetParameter(GAPROLE_ADVERT_ENABLED, sizeof(uint8_t), &initial_advertising_enable); GAPRole_SetParameter(GAPROLE_ADVERT_OFF_TIME, sizeof(uint16_t), &gapRole_AdvertOffTime); // GAPRole_SetParameter(GAPROLE_SCAN_RSP_DATA, sizeof (scanRspData), scanRspData); GAPRole_SetParameter(GAPROLE_ADVERT_DATA, sizeof(broadcastData), broadcastData); GAPRole_SetParameter(GAPROLE_ADV_EVENT_TYPE, sizeof(uint8_t), &advType); } // Set advertising interval { uint16_t advInt = DEFAULT_ADVERTISING_INTERVAL; GAP_SetParamValue(TGAP_LIM_DISC_ADV_INT_MIN, advInt); GAP_SetParamValue(TGAP_LIM_DISC_ADV_INT_MAX, advInt); GAP_SetParamValue(TGAP_GEN_DISC_ADV_INT_MIN, advInt); GAP_SetParamValue(TGAP_GEN_DISC_ADV_INT_MAX, advInt); } // Start the Device VOID GAPRole_StartDevice(&simpleBLEBroadcaster_BroadcasterCBs); }
and this is the code I update the data:
updateValue(); //update broadcast Data GAPRole_SetParameter(GAPROLE_ADVERT_DATA, sizeof(broadcastData), broadcastData);
and broadcastData :
static uint8_t broadcastData[] = { // length of device name (deviceNameLength + 1), // length of this data GAP_ADTYPE_LOCAL_NAME_COMPLETE, 0x53, // S 0x54, // T // 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_ADTYPE_FLAGS, GAP_ADTYPE_FLAGS_BREDR_NOT_SUPPORTED, 0x16, // length of this data including the data type byte GAP_ADTYPE_MANUFACTURER_SPECIFIC, // manufacturer specific adv data type 0x0D, // Company ID - Fixed 0x00, // Company ID - Fixed 0x02, // Data Type - Fixed 0x11, // Data Length - Fixed 0x00, // Major 0x01, // Major 0x00, // Minor 0x01, // Minor 0xc5, // Power - The 2's complement of the calibrated Tx Power 0xAA, // 6 accel 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xBB, // 6 gyro 0xBB, 0xBB, 0xBB, 0xBB, 0xBB };
My English is not very good.
and this is my first post , if something doesn't right,
Thanks for your consideration for any inconvenience caused.
I have resolved this by replace the code:
GAPRole_SetParameter(GAPROLE_ADVERT_DATA, sizeof(broadcastData), broadcastData);
to this code:
GAP_UpdateAdvertisingData(selfEntity,TRUE,sizeof(broadcastData),broadcastData);
and it's work fine.
but still can't get why
GAPRole_SetParameter()
can't work.
Hi Laurence,
Glad you found a solution.
The advertisement data can only be updated when advertising is not enabled.