Skip to content

Warnings when compiling this code #310

Closed

Description

@roleroz

When you build the code in this library there are several warnings printed

  • Order member initialization on BLELocalCharacteristic (fixed by Fix warnings #302)
  • Unused variables in: (fixed by Fix warnings #302)
    • HCIClass::tryResolveAddress
    • HCIClass::handleEventPkt (the whole else if statement did nothing)
    • L2CAPSignalingClass::handleSecurityData (one initialization should be inside of BLE_TRACE)
    • BluetoothCryptoToolbox::f5
    • BluetoothCryptoToolbox::testAh
    • BluetoothCryptoToolbox::testg2
  • Uninitialized variable in L2CAPSignalingClass::handleSecurityData (fixed by Fix warnings #302)
  • Unenumerated case in ArduinoBLE/src/utility/HCI.cpp (would be fixed by merge of fix(HCI): missing LE_Event_Mask #386)
I have a PR ready for fixing most of these warnings (all except the last one) in https://github.com//pull/302, but I haven't had luck getting any traction on getting that reviewed

If someone could review that PR most of these things would be fixed.

If someone tells me what 0x0A means in that unenumerated case, I'm happy to add that to the enum as well

Additional context

Additional reports

Related

Activity

  1. added
    type: imperfection
    topic: code
    on Jul 20, 2023
  2. linked a pull request that will close this issueFix warnings #302on Jul 20, 2023
  3. roleroz commented on Aug 4, 2023

    @roleroz
    ContributorAuthor

    This is still incomplete, there is also the unenumerated case in ArduinoBLE/src/utility/HCI.cpp, if someone can tell me what does 0x0A means in that file, I'll create a PR for it

  4. added
    conclusion: resolved
    and removed
    conclusion: resolved
    on Aug 5, 2023
  5. reopened this on Aug 5, 2023
  6. ataweg commented on Jan 17, 2024

    @ataweg

    Issue "Unenumerated case in ArduinoBLE/src/utility/HCI.cpp" not fixed . Depending on the Preferences "Compiler warnings" set to All or More there is an error message:

    f:\Projects\Arduino\libraries\ArduinoBLE\src\utility\HCI.cpp: In member function 'virtual void HCIClass::handleEventPkt(uint8_t, uint8_t*)':
    f:\Projects\Arduino\libraries\ArduinoBLE\src\utility\HCI.cpp:991:7: error: case value '10' not in enumerated type 'LE_META_EVENT' [-Werror=switch]
           case 0x0A:{
           ^~~~
    cc1plus.exe: some warnings being treated as errors
    
  7. fpistm commented on Mar 14, 2025

    @fpistm
    Contributor

    This 0x0A value was introduced with PR #156
    It seems to be a the same than CONN_COMPLETE with only 2 fields added in the struct:

              uint8_t localResolvablePrivateAddress[6];
              uint8_t peerResolvablePrivateAddress[6];
    

    But never filled. Only print when BLE_TRACE is enabled.

    Maybe @unknownconstant could comment on this?

  8. added a commit that references this issue on Mar 20, 2025
  9. unknownconstant commented on Mar 21, 2025

    @unknownconstant
    Contributor

    Let me take a look - it's been a while since I've been through this code

  10. fpistm commented on Mar 21, 2025

    @fpistm
    Contributor

    I think I've found which LE META EVENT it is.
    It seems to be the LE Enhanced Connection Complete Event.

    Image

    I would propose this as a fix:

    ----------------------------- src/utility/HCI.cpp -----------------------------
    index 0e64063..2394fbb 100644
    @@ -993,7 +993,7 @@ void HCIClass::handleEventPkt(uint8_t /*plen*/, uint8_t pdata[])
         Serial.println(leMetaHeader->subevent,HEX);
     #endif
         switch((LE_META_EVENT)leMetaHeader->subevent){
    -      case 0x0A:{
    +      case ENHANCED_CONN_COMPLETE:{
             struct __attribute__ ((packed)) EvtLeConnectionComplete {
               uint8_t status;
               uint16_t handle;
    
    ------------------------------ src/utility/HCI.h ------------------------------
    index 0a530ce..a6fa66e 100644
    @@ -46,7 +46,8 @@ enum LE_META_EVENT {
       LONG_TERM_KEY_REQUEST     = 0x05,
       REMOTE_CONN_PARAM_REQ     = 0x06,
       READ_LOCAL_P256_COMPLETE  = 0x08,
    -  GENERATE_DH_KEY_COMPLETE  = 0x09
    +  GENERATE_DH_KEY_COMPLETE  = 0x09,
    +  ENHANCED_CONN_COMPLETE    = 0x0A,
     };
     String metaEventToString(LE_META_EVENT event);
     String commandToString(LE_COMMAND command);
  11. linked a pull request that will close this issuefix(HCI): missing LE_Event_Mask #386on Mar 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    conclusion: resolvedtopic: codetype: imperfection

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions