btashton opened a new pull request #1666:
URL: https://github.com/apache/incubator-nuttx/pull/1666


   ## Summary
   For Bluetooth sockets use the Linux sockaddr types:
   
   ```
   struct sockaddr_l2
   {
     sa_family_t  l2_family;       /* Must be AF_BLUETOOTH */
     uint16_t     l2_psm;          /* Protocol Service Multiplexer (PSM) */
     bt_addr_t    l2_bdaddr;       /* 6-byte Bluetooth address */
     uint16_t     l2_cid;          /* Channel identifier (CID) */
     uint8_t      l2_bdaddr_type;  /* Bluetooth address type */
   };
   
   struct sockaddr_hci
   {
     sa_family_t hci_family;   /* Must be AF_BLUETOOTH */
     uint16_t    hci_dev;      /* Network Device ID */
     uint16_t    hci_channel;  /* Channel: USER, MONITOR, CONTROL, etc... */
   };
   
   struct sockaddr_rc
   {
     sa_family_t  bt_family;  /* Must be AF_BLUETOOTH */
     bt_addr_t    bt_bdaddr;  /* 6-byte Bluetooth address */
     uint8_t      bt_channel; /* Channel identifier (CID) */
     sa_family_t rc_family;    /* Must be AF_BLUETOOTH */
     bt_addr_t   rc_bdaddr;    /* 6-byte Bluetooth address */
     uint8_t     rc_channel;   /* Channel number */
   };
   ```
   
   ## Impact
   Before everything was using L2CAP protocol sockets with a NuttX specific 
sockaddr struct `sockaddr_bt_s`  This struct is removed and application code 
should use the correct addr type for the socket needed.  This change does not 
add support for HCI or RFCOMM protocols so existing code should just switch to 
`sockaddr_l2` and make the minor change to `br_channel` -> `l2_cid` br_bdaddr` 
-> `l2_bdaddr` `br_family` -> `l2_family`
   
   ## Testing
   This was validated with `btsak` application with changes in PR 
https://github.com/apache/incubator-nuttx-apps/pull/374
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to