Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change address and advertisement #40

Open
beckmx opened this issue Sep 7, 2023 · 0 comments
Open

Change address and advertisement #40

beckmx opened this issue Sep 7, 2023 · 0 comments

Comments

@beckmx
Copy link

beckmx commented Sep 7, 2023

Hello guys, I have been trying to change the address of the device, it compiles properly but somehow i am not able to change it, i also want to advertise custom data but no luck yet.

#include <SPI.h>
#include <BLEUtil.h>
#include <BLEPeripheral.h>
#include <utility/RFduino/ble_gap.h>
#include <utility/RFduino/ble_gatt.h>
#include <Arduino.h>

BLEPeripheral *advertiser;
iBeacon beacon;
void setup(){
	  // Changing Bluetooth Address
  ble_gap_addr_t gap_address;
  gap_address.addr_type = BLE_GAP_ADDR_TYPE_RANDOM_STATIC;
  gap_address.addr[0] = 0xac;  // Least significant byte
  gap_address.addr[1] = 0x06;
  gap_address.addr[2] = 0x50;
  gap_address.addr[3] = 0x97;
  gap_address.addr[4] = 0xa5;
  gap_address.addr[5] = 0xf9;  // Most significant byte

  sd_ble_gap_address_set(BLE_GAP_ADDR_CYCLE_MODE_NONE, &gap_address);
  
	advertiser=new(BLEPeripheral);
  	advertiser->setConnectable(false);
	uint8_t custom_payload[] = {0xFF,0x4c, 0x00, 0x12, 0x19, 0x00,
  0xf8, 0x6d, 0xa4, 0xbc, 0x43, 0x65, 0x99, 0x62,
  0x0f, 0x53, 0x52, 0x01, 0x3e, 0x1f, 0x94, 0xb4,
  0x3f, 0x91, 0x00, 0x92, 0x54, 0x26,
  0x2, 0x00}; // Example payload
  advertiser->setManufacturerData(custom_payload, sizeof(custom_payload));

  advertiser->begin();
}

In theory i should be able to change the address and avertise but it doesnt happen :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant