9 Replies Latest reply on Jan 13, 2017 4:20 AM by ajaymishra1139_2239006

    CYBLE_EVT_... enum codes

    i.buliev_1817031

      Is it possible to find out what BLE Stack Event is taking place based on its enumeration? In my case, I get an event code 0x104 but I have no idea where it comes from and what it means.

        • 1. Re: CYBLE_EVT_... enum codes
          jeff.sylvester

          Go to the file where your main BLE call back function is located, Use the tool to look up the definition   (left click on one of the cases) and the tool will bring you to the file where all the definitions are located, it is a header file in the BLE stack. 

          • 2. Re: CYBLE_EVT_... enum codes
            i.buliev_1817031

            What you suggest is how to find the event id's numerical value from the definition, which is used in the code.

               

            The problem is the opposite one - the event is not covered by the known 'case'-s and the code execution reaches the 'default' section of the 'switch(event) {...}'; there I can read the value of the 'event' variable but I can't find any way to relate it to an event definition, so that I understand what kind of event was actually caught. 

            • 3. Re: CYBLE_EVT_... enum codes
              jeff.sylvester

              need more information, however I am not the support guy so it probably wont do any good anyway,  if the event is not covered, it sounds to me like a fault,   is your stack and other tool components upto date?  this is just a suggestion,  OR perhaps you are doing something that is not covered in the stack at the moment,  example trying to run BLE 4.2 on 4.1 compatible hardware,  

                 

              as for the ability to do what you are asking,  not sure how to do that since the stack is automatically generated by the tool, you have to get an answer from the guy who wrote the tool and/or compiler.  If your event is not covered by the stack,  the only thing you can do is waste a lot of time actually reading all the events included in the stack you are using and compare that to the actual documentation provided by Bluetooth SIG.  

                 

              I suppose there is also a possibility that you have a hardware failure,  but more likely a software issue,  if you can run some example code successfully you can eliminate the hardware fault possibility, but thats not a lot of help either,  

              • 4. Re: CYBLE_EVT_... enum codes
                i.buliev_1817031

                Thanks jetro570. Everything is updated and I use a brand new CYBLE-022001-EVAL board. For the moment, the event that appears does not influence the rest of the functionality but I'll continue to search what the reason for that could be. 

                • 5. Re: CYBLE_EVT_... enum codes
                  jrow

                  You can use the "Find In Files" tool in PSoC Creator (Edit->Find and Replace->Find In Files or simply press Ctrl+Shift+F). Make sure you select "Current Project" for the "Look in:" option, and look for the name of the enum data type you know the function is returning, to find it in the auto-generated component source or header file.

                     

                  The event IDs are primarily defined in CYBLE_EVENT_T, but note there is another enum data type called CYBLE_EVT_T which has a lot of profile-specific events. This is probably not the one you want.

                     

                  The downside to enums is that (usually) not every identifier is explicitly included in the code. You'll have to work backwards up the code until you find one explicit value, then increment on your own with each new identifier until you get to the value you are trying to figure out.

                  • 6. Re: CYBLE_EVT_... enum codes
                    user_1377889

                    @jrow

                       

                    Enums for events are in the range of 0 to 255, but in this case there is a 0x104 which is out of the maximum range. I am quite sure to have seen a similar question some months ago, but I am not able to dig out the question nor the answer...

                       

                     

                       

                    Bob

                    • 7. Re: CYBLE_EVT_... enum codes
                      i.buliev_1817031

                      I followed the advice of jrow and I found a definition of CYBLE_EVT_GATTS_INDICATION_ENABLED in fact equal to 0x104. This is where the service-specific events are enumerated (enum CYBLE_EVT_T). This should be the answer, I guess.

                      • 8. Re: CYBLE_EVT_... enum codes
                        jeff.sylvester
                                Also might help, the debug UART can give you a general sense of where your at in the code , this is more system level, but maybe might help   
                        • 9. Re: CYBLE_EVT_... enum codes
                          ajaymishra1139_2239006

                          Hi,

                             

                          This is very typical. It is beyond my knowledge of this domain to give a precise answer to this.

                             

                          --------------
                          Regards
                          Ajay Mishra
                          Webworld Experts Reviews