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

Commit 5cf3cb81 authored by Chris Manton's avatar Chris Manton
Browse files

stack::rfcomm Use nodiscard for API to ensure return values handled

Bug: 339906222
Test: m .
Flag: EXEMPT, Logging Change

Change-Id: If964240cc2ff46e28d259cc59910983ac8dc800c
parent 024d75f6
Loading
Loading
Loading
Loading
+29 −31
Original line number Diff line number Diff line
@@ -184,11 +184,9 @@ typedef void(tPORT_CALLBACK)(uint32_t code, uint16_t port_handle);
 * (scn * 2 + 1) dlci.
 *
 ******************************************************************************/
int RFCOMM_CreateConnectionWithSecurity(uint16_t uuid, uint8_t scn,
                                        bool is_server, uint16_t mtu,
                                        const RawAddress& bd_addr,
                                        uint16_t* p_handle,
                                        tPORT_CALLBACK* p_mgmt_cb,
[[nodiscard]] int RFCOMM_CreateConnectionWithSecurity(
    uint16_t uuid, uint8_t scn, bool is_server, uint16_t mtu,
    const RawAddress& bd_addr, uint16_t* p_handle, tPORT_CALLBACK* p_mgmt_cb,
    uint16_t sec_mask);

/*******************************************************************************
@@ -211,11 +209,10 @@ int RFCOMM_CreateConnectionWithSecurity(uint16_t uuid, uint8_t scn,
 *                                     frames
 *
 ******************************************************************************/
extern int RFCOMM_ControlReqFromBTSOCK(uint8_t dlci, const RawAddress& bd_addr,
                                       uint8_t modem_signal,
                                       uint8_t break_signal,
                                       uint8_t discard_buffers,
                                       uint8_t break_signal_seq, bool fc);
[[nodiscard]] int RFCOMM_ControlReqFromBTSOCK(
    uint8_t dlci, const RawAddress& bd_addr, uint8_t modem_signal,
    uint8_t break_signal, uint8_t discard_buffers, uint8_t break_signal_seq,
    bool fc);

/*******************************************************************************
 *
@@ -226,7 +223,7 @@ extern int RFCOMM_ControlReqFromBTSOCK(uint8_t dlci, const RawAddress& bd_addr,
 * Parameters:      handle     - Handle of the port returned in the Open
 *
 ******************************************************************************/
int RFCOMM_RemoveConnection(uint16_t handle);
[[nodiscard]] int RFCOMM_RemoveConnection(uint16_t handle);

/*******************************************************************************
 *
@@ -237,7 +234,7 @@ int RFCOMM_RemoveConnection(uint16_t handle);
 * Parameters:      handle     - Handle returned in the RFCOMM_CreateConnection
 *
 ******************************************************************************/
int RFCOMM_RemoveServer(uint16_t handle);
[[nodiscard]] int RFCOMM_RemoveServer(uint16_t handle);

/*******************************************************************************
 *
@@ -251,7 +248,8 @@ int RFCOMM_RemoveServer(uint16_t handle);
 *                                 specified in the mask occurs.
 *
 ******************************************************************************/
int PORT_SetEventCallback(uint16_t port_handle, tPORT_CALLBACK* p_port_cb);
[[nodiscard]] int PORT_SetEventCallback(uint16_t port_handle,
                                        tPORT_CALLBACK* p_port_cb);

/*******************************************************************************
 *
@@ -263,9 +261,9 @@ int PORT_SetEventCallback(uint16_t port_handle, tPORT_CALLBACK* p_port_cb);
 * Parameters:      handle     - Handle returned in the RFCOMM_CreateConnection
 *
 ******************************************************************************/
int PORT_ClearKeepHandleFlag(uint16_t port_handle);
[[nodiscard]] int PORT_ClearKeepHandleFlag(uint16_t port_handle);

int PORT_SetDataCOCallback(uint16_t port_handle,
[[nodiscard]] int PORT_SetDataCOCallback(uint16_t port_handle,
                                         tPORT_DATA_CO_CALLBACK* p_port_cb);
/*******************************************************************************
 *
@@ -278,7 +276,7 @@ int PORT_SetDataCOCallback(uint16_t port_handle,
 *                           of zero disables all events.
 *
 ******************************************************************************/
int PORT_SetEventMask(uint16_t port_handle, uint32_t mask);
[[nodiscard]] int PORT_SetEventMask(uint16_t port_handle, uint32_t mask);

/*******************************************************************************
 *
@@ -292,7 +290,7 @@ int PORT_SetEventMask(uint16_t port_handle, uint32_t mask);
 *                  p_lcid     - OUT L2CAP's LCID
 *
 ******************************************************************************/
int PORT_CheckConnection(uint16_t handle, RawAddress* bd_addr,
[[nodiscard]] int PORT_CheckConnection(uint16_t handle, RawAddress* bd_addr,
                                       uint16_t* p_lcid);

/*******************************************************************************
@@ -306,7 +304,7 @@ int PORT_CheckConnection(uint16_t handle, RawAddress* bd_addr,
 *                  bd_addr    - bd_addr of the peer
 *
 ******************************************************************************/
bool PORT_IsOpening(RawAddress* bd_addr);
[[nodiscard]] bool PORT_IsOpening(RawAddress* bd_addr);

/*******************************************************************************
 *
@@ -320,7 +318,7 @@ bool PORT_IsOpening(RawAddress* bd_addr);
 *                               configuration information for the connection.
 *
 ******************************************************************************/
int PORT_SetState(uint16_t handle, tPORT_STATE* p_settings);
[[nodiscard]] int PORT_SetState(uint16_t handle, tPORT_STATE* p_settings);

/*******************************************************************************
 *
@@ -334,7 +332,7 @@ int PORT_SetState(uint16_t handle, tPORT_STATE* p_settings);
 *                               configuration information is returned.
 *
 ******************************************************************************/
int PORT_GetState(uint16_t handle, tPORT_STATE* p_settings);
[[nodiscard]] int PORT_GetState(uint16_t handle, tPORT_STATE* p_settings);

/*******************************************************************************
 *
@@ -349,7 +347,7 @@ int PORT_GetState(uint16_t handle, tPORT_STATE* p_settings);
 *                  enable     - enables data flow
 *
 ******************************************************************************/
int PORT_FlowControl_MaxCredit(uint16_t handle, bool enable);
[[nodiscard]] int PORT_FlowControl_MaxCredit(uint16_t handle, bool enable);

#define PORT_DTRDSR_ON 0x01
#define PORT_CTSRTS_ON 0x02
@@ -387,7 +385,7 @@ int PORT_FlowControl_MaxCredit(uint16_t handle, bool enable);
 *                  p_len       - Byte count received
 *
 ******************************************************************************/
int PORT_ReadData(uint16_t handle, char* p_data, uint16_t max_len,
[[nodiscard]] int PORT_ReadData(uint16_t handle, char* p_data, uint16_t max_len,
                                uint16_t* p_len);

/*******************************************************************************
@@ -403,8 +401,8 @@ int PORT_ReadData(uint16_t handle, char* p_data, uint16_t max_len,
 *                  p_len       - Bytes written
 *
 ******************************************************************************/
int PORT_WriteData(uint16_t handle, const char* p_data, uint16_t max_len,
                   uint16_t* p_len);
[[nodiscard]] int PORT_WriteData(uint16_t handle, const char* p_data,
                                 uint16_t max_len, uint16_t* p_len);

/*******************************************************************************
 *
@@ -416,7 +414,7 @@ int PORT_WriteData(uint16_t handle, const char* p_data, uint16_t max_len,
 * Parameters:      handle     - Handle returned in the RFCOMM_CreateConnection
 *
 ******************************************************************************/
int PORT_WriteDataCO(uint16_t handle, int* p_len);
[[nodiscard]] int PORT_WriteDataCO(uint16_t handle, int* p_len);

/*******************************************************************************
 *
@@ -438,7 +436,7 @@ void RFCOMM_Init(void);
 *                  result. Note that the string returned must not be freed.
 *
 ******************************************************************************/
const char* PORT_GetResultString(const uint8_t result_code);
[[nodiscard]] const char* PORT_GetResultString(const uint8_t result_code);

/*******************************************************************************
 *
@@ -449,6 +447,6 @@ const char* PORT_GetResultString(const uint8_t result_code);
 * Returns          the security bitmask.
 *
 ******************************************************************************/
int PORT_GetSecurityMask(uint16_t handle, uint16_t* sec_mask);
[[nodiscard]] int PORT_GetSecurityMask(uint16_t handle, uint16_t* sec_mask);

#endif /* PORT_API_H */