Advertisement
Guest User

Untitled

a guest
Dec 16th, 2017
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  1. /*
  2. * BLESecurity.h
  3. *
  4. * Created on: Dec 17, 2017
  5. * Author: chegewara
  6. */
  7.  
  8. #ifndef COMPONENTS_CPP_UTILS_BLESECURITY_H_
  9. #define COMPONENTS_CPP_UTILS_BLESECURITY_H_
  10. #include <esp_gap_ble_api.h>
  11.  
  12. class BLESecurity {
  13. public:
  14. BLESecurity();
  15. virtual ~BLESecurity();
  16. void setAuthenticationMode(esp_ble_auth_req_t auth_req);
  17. void setCapability(esp_ble_io_cap_t iocap);
  18. void setInitEncryptionKey(uint8_t init_key, uint8_t key_size = 16);
  19. void setRespEncryptionKey(uint8_t resp_key, uint8_t key_size = 16);
  20.  
  21. private:
  22. esp_ble_auth_req_t m_authReq;
  23. esp_ble_io_cap_t m_iocap;
  24. uint8_t m_initKey;
  25. uint8_t m_respKey;
  26. uint8_t m_keySize;
  27. };
  28.  
  29. class BLESecurityCallbacks {
  30. public:
  31. virtual ~BLESecurityCallbacks();
  32.  
  33. virtual uint32_t onPassKeyRequest();
  34. virtual void onPassKeyNotify(uint32_t pass_key);
  35. virtual bool onSecurityRequest();
  36. virtual void onAuthenticationComplete(bool success);
  37. };
  38.  
  39. #endif /* COMPONENTS_CPP_UTILS_BLESECURITY_H_ */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement