Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 965f4fcd authored by Chris Manton's avatar Chris Manton
Browse files

Encapulate tBTM_SEC_DEV_REC::pin_code_length

Towards readable code

Bug: 163134718
Tag: #refactor
Test: act.py -tc BleCocTest
Test: ble paired 2 phones
Test: classic paired Bose SoundLink
Change-Id: Ic48c5e60495b4308bf6c7b26e9de18745453bed8
parent c04439ea
Loading
Loading
Loading
Loading
+20 −0
Original line number Diff line number Diff line
@@ -154,8 +154,28 @@ typedef struct {
  RawAddress bd_addr;      /* BD_ADDR of the device              */
  DEV_CLASS dev_class;     /* DEV_CLASS of the device            */
  LinkKey link_key;        /* Device link key                    */

 private:
  friend bool BTM_SecAddDevice(const RawAddress& bd_addr, DEV_CLASS dev_class,
                               BD_NAME bd_name, uint8_t* features,
                               LinkKey* p_link_key, uint8_t key_type,
                               uint8_t pin_length);
  friend void BTM_PINCodeReply(const RawAddress& bd_addr, uint8_t res,
                               uint8_t pin_len, uint8_t* p_pin);
  friend void btm_sec_auth_complete(uint16_t handle, uint8_t status);
  friend void btm_sec_connected(const RawAddress& bda, uint16_t handle,
                                uint8_t status, uint8_t enc_mode);
  friend void btm_sec_encrypt_change(uint16_t handle, uint8_t status,
                                     uint8_t encr_enable);
  friend void btm_sec_link_key_notification(const RawAddress& p_bda,
                                            const Octet16& link_key,
                                            uint8_t key_type);
  friend tBTM_STATUS btm_sec_bond_by_transport(const RawAddress& bd_addr,
                                               tBT_TRANSPORT transport,
                                               uint8_t pin_len, uint8_t* p_pin);
  uint8_t pin_code_length; /* Length of the pin_code used for paring */

 public:
  uint16_t sec_flags; /* Current device security state      */
  bool is_device_authenticated() const {
    return sec_flags & BTM_SEC_AUTHENTICATED;