whitelist help

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
DaBr_1233126
Level 4
Level 4
10 likes given 5 likes given First like received

Hello everyone!

   

I am working with the whitelist example from the 100 projects list.

   

I wanted to take it a step further and via code have an address already in the whitelist.

   

So in the beginning of main.c I've added the definition for MasterFob as follows:

   

//Structure containing address of device

   

CYBLE_GAP_BD_ADDR_T whitelistdeviceaddress;

   

CYBLE_GAP_BD_ADDR_T MasterFob;

   

Then in the main() when initizing variables I tryed to do this:

   

MasterFob = 0x00A050022629;

   

I get an error here about trying to assign type "CYBLE_GAP_BD_ADDR_T" from type 'long long int'

   

Can someone tell me the correct way of doing this?

   

Afterwards, I plan on adding:

   

CyBle_GapAddDeviceToWhiteList(&MasterFob);

   

This I think will get my device into the list.

   

All help is appreciated!

   

Dan

0 Likes
1 Solution
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

CYBLE_GAP_BD_ADDR_T is a pointer, so try

   

MasterFob = (CYBLE_GAP_BD_ADDR_T *) MasterTemp;

   

I didn't dig deep into the whitelist definition, so easiest will be to search in project for "CYBLE_GAP_BD_ADDR_T"

   

 

   

Bob

View solution in original post

0 Likes
4 Replies
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

Did you already try a type cast?

   

 

   

Bob

0 Likes
DaBr_1233126
Level 4
Level 4
10 likes given 5 likes given First like received

Hello Bob!

   

Thanks for getting back to me!

   

So I tried:

   

MasterFob = (CYBLE_GAP_BD_ADDR_T) 0x00A050022629;

   

And I got an error about 'used type 'CYBLE_GAP_BD_ADDR_T' where arithmetic or pointer type is required.'

   

I also tried:

   

MasterTemp = 0x00A050022629;    // Defined as type long long

   

MasterFob = (CYBLE_GAP_BD_ADDR_T) MasterTemp;

   

And got same error.

   

Dan

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

CYBLE_GAP_BD_ADDR_T is a pointer, so try

   

MasterFob = (CYBLE_GAP_BD_ADDR_T *) MasterTemp;

   

I didn't dig deep into the whitelist definition, so easiest will be to search in project for "CYBLE_GAP_BD_ADDR_T"

   

 

   

Bob

0 Likes
Anonymous
Not applicable

CYBLE_GAP_BD_ADDR_T     MasterFob;

   

long long MasterTemp = 0x00A050022629;
MasterFob=(CYBLE_GAP_BD_ADDR_T*)MasterTemp;

   

Error Too. 

   

How do it correctly ?

   

Thanks !!

0 Likes