Please post your code so we can check it.
I've uploaded it, it's just the example code provided with Creator. Understand that the example code works and that I am asking only about how to understand how Creator works so that I could build the BLE_FindMe code myself, from scratch. Currently, I just don't see anything that would make me think to create the switch statement that uses alertLevel. While alertLevel is declared on line 18 in ias.c, I just don't see anything that equates that variable with the Alert Level characteristic in the Profiles tab of Configure 'BLE'.
Are you trying to understand how to use the BLE profiles from a programming perspective?
Generally, the Cypress BLE DB holds it's own data for the BLE characteristics, and you only need to call the cypress functions with variables passed containing the new values you want assigned/changed in the DB. This allows for abstraction between your own code, and the memory allocation procedure for the BLE profile.
For the FindMe profile, I don't believe that the local code running actually changes the alert level; iirc, it is changed by the remote phone that connects to it, and merely changes the LED states to reflect that. In order to understand the underlying connectiong between the memory, characteristics, and the BLE GATT DB, I would suggest reading through the custom profile application note: http://www.cypress.com/documentation/application-notes/an91162-creating-ble-custom-profile
and to try out some of the examples that have two-way characteristic value changes.
For the FindMe example, the alertlevel is being written in the IasEventHandler() function using a pointer passed to the function CyBle_IassGetCharacteristicValue(CYBLE_IAS_ALERT_LEVEL, sizeof(alertLevel), &alertLevel);
Yes, I am trying to understand how to use the BLE profiles from a programming perspective.
I have read AN91162 and have questions because when I compare the generated code from my own BLE Find Me project, consisting of only a single BLE component set to the Find Me profile with that provided by Cypress in the BLE_FindMe project, I see that my build doesn't have the ias.c or ias.h files included in the BLE_FindMe example project.
It is in those files that the alertLevel variable is declared but as they are not created by default, I wouldn't know that the alertLevel variable needs to be created. Also, it is in the ias.h that the Ias EventHandler() is declared and defined in ias.c. This function calls CyBle_IassGetCharacteristicValue(), but again I don't remember seeing anything about needing to write that and IasEventHandler is not found in the BLE datasheet (I searched for it).
So, I think that there is either a) programming information missing from the existing Cypress documentation, (b) I just haven't found it or (c) I didn't realize what I was reading. I suppose that I could have missed something in configuring the simple BLE Find Me profile that cause ias.c and ias.h to be generated.
Ah, yeah... When you generate a BLE profile, if the profile is not a "Standard Bluetooth" profile, then it won't generate the nice event handlers specific to that service. Hence why it isn't generating the IAS.c/h files. Thus, all of the "IAS" code is pre-generated for the pre-built BLE profile that you are looking at in the example. Unfortunately, if you are wanting to build one from scratch, then it won't auto-generate those useful bits of code :)
There are mismatches in what is implemented, and what you have to write yourself depending on what you are doing:
Standard/prebuild profiles will have it all done for you, like you have seen with the IAS example;
Prebuilt services will have their UUIDs predefined and set to 16 bit values (I don't know what else is included with them);
Custom profiles/services will require you to implement the event handler for the entire BLE stack, and thus if you want to separate them for the separate services, then you will need to split it yourself :(
Probably a little bit of each of a,b,c if you want it clearly defined :/
There are many pre-generated files that change how much work you have to code on your own, but they all still fundamentally operate the same way; Like calling the CyBle_IassGetCharacteristicValue() will internally make CyBle calls to the BLE database to request the value based on a UUID or handle (index basically).
Try looking for the custom profile examples in the 100 projects in 100 days examples, as I feel that observing the implementation of those helped me the most with understanding what the Compiler was doing, the BLESS was doing, and what I needed to do for various functions. Ultimately however, testing will get you the farthest :)
Thanks for that information, it's what I ws looking for. At least knowing that gives me information as to wht I need to look out for and what to expect. I will check out those 100 projects in 100 days.
I got frustrated with the exact same thing when I started as well. Thankfully, it is all in the source code :)