Loading system/stack/rfcomm/port_api.cc +18 −18 Original line number Diff line number Diff line Loading @@ -200,7 +200,7 @@ int RFCOMM_CreateConnection(uint16_t uuid, uint8_t scn, bool is_server, } // Assign port specific values p_port->state = PORT_STATE_OPENING; p_port->state = PORT_CONNECTION_STATE_OPENING; p_port->uuid = uuid; p_port->is_server = is_server; p_port->scn = scn; Loading Loading @@ -267,12 +267,12 @@ int RFCOMM_RemoveConnection(uint16_t handle) { } p_port = &rfc_cb.port.port[handle - 1]; if (!p_port->in_use || (p_port->state == PORT_STATE_CLOSED)) { if (!p_port->in_use || (p_port->state == PORT_CONNECTION_STATE_CLOSED)) { RFCOMM_TRACE_EVENT("RFCOMM_RemoveConnection() Not opened:%d", handle); return (PORT_SUCCESS); } p_port->state = PORT_STATE_CLOSING; p_port->state = PORT_CONNECTION_STATE_CLOSING; port_start_close(p_port); Loading @@ -299,7 +299,7 @@ int RFCOMM_RemoveServer(uint16_t handle) { /* Do not report any events to the client any more. */ p_port->p_mgmt_callback = nullptr; if (!p_port->in_use || (p_port->state == PORT_STATE_CLOSED)) { if (!p_port->in_use || (p_port->state == PORT_CONNECTION_STATE_CLOSED)) { VLOG(1) << __func__ << ": handle " << handle << " not opened"; return (PORT_SUCCESS); } Loading @@ -307,7 +307,7 @@ int RFCOMM_RemoveServer(uint16_t handle) { /* this port will be deallocated after closing */ p_port->keep_port_handle = false; p_port->state = PORT_STATE_CLOSING; p_port->state = PORT_CONNECTION_STATE_CLOSING; port_start_close(p_port); Loading Loading @@ -339,7 +339,7 @@ int PORT_SetEventCallback(uint16_t port_handle, tPORT_CALLBACK* p_port_cb) { p_port = &rfc_cb.port.port[port_handle - 1]; if (!p_port->in_use || (p_port->state == PORT_STATE_CLOSED)) { if (!p_port->in_use || (p_port->state == PORT_CONNECTION_STATE_CLOSED)) { return (PORT_NOT_OPENED); } Loading Loading @@ -399,7 +399,7 @@ int PORT_SetDataCOCallback(uint16_t port_handle, p_port = &rfc_cb.port.port[port_handle - 1]; if (!p_port->in_use || (p_port->state == PORT_STATE_CLOSED)) { if (!p_port->in_use || (p_port->state == PORT_CONNECTION_STATE_CLOSED)) { return (PORT_NOT_OPENED); } Loading Loading @@ -431,7 +431,7 @@ int PORT_SetEventMask(uint16_t port_handle, uint32_t mask) { p_port = &rfc_cb.port.port[port_handle - 1]; if (!p_port->in_use || (p_port->state == PORT_STATE_CLOSED)) { if (!p_port->in_use || (p_port->state == PORT_CONNECTION_STATE_CLOSED)) { return (PORT_NOT_OPENED); } Loading Loading @@ -466,7 +466,7 @@ int PORT_CheckConnection(uint16_t handle, RawAddress* bd_addr, (p_port->rfc.p_mcb ? p_port->rfc.p_mcb->peer_ready : -1), p_port->rfc.state); if (!p_port->in_use || (p_port->state == PORT_STATE_CLOSED)) { if (!p_port->in_use || (p_port->state == PORT_CONNECTION_STATE_CLOSED)) { return (PORT_NOT_OPENED); } Loading Loading @@ -551,7 +551,7 @@ int PORT_SetState(uint16_t handle, tPORT_STATE* p_settings) { p_port = &rfc_cb.port.port[handle - 1]; if (!p_port->in_use || (p_port->state == PORT_STATE_CLOSED)) { if (!p_port->in_use || (p_port->state == PORT_CONNECTION_STATE_CLOSED)) { return (PORT_NOT_OPENED); } Loading Loading @@ -596,7 +596,7 @@ int PORT_GetState(uint16_t handle, tPORT_STATE* p_settings) { p_port = &rfc_cb.port.port[handle - 1]; if (!p_port->in_use || (p_port->state == PORT_STATE_CLOSED)) { if (!p_port->in_use || (p_port->state == PORT_CONNECTION_STATE_CLOSED)) { return (PORT_NOT_OPENED); } Loading Loading @@ -636,7 +636,7 @@ int PORT_FlowControl_MaxCredit(uint16_t handle, bool enable) { p_port = &rfc_cb.port.port[handle - 1]; if (!p_port->in_use || (p_port->state == PORT_STATE_CLOSED)) { if (!p_port->in_use || (p_port->state == PORT_CONNECTION_STATE_CLOSED)) { return (PORT_NOT_OPENED); } Loading Loading @@ -707,12 +707,12 @@ int PORT_ReadData(uint16_t handle, char* p_data, uint16_t max_len, p_port = &rfc_cb.port.port[handle - 1]; if (!p_port->in_use || (p_port->state == PORT_STATE_CLOSED)) { if (!p_port->in_use || (p_port->state == PORT_CONNECTION_STATE_CLOSED)) { return (PORT_NOT_OPENED); } if (p_port->state == PORT_STATE_OPENING) { LOG_WARN("Trying to read a port in PORT_STATE_OPENING state"); if (p_port->state == PORT_CONNECTION_STATE_OPENING) { LOG_WARN("Trying to read a port in PORT_CONNECTION_STATE_OPENING state"); } if (p_port->line_status) { Loading Loading @@ -867,7 +867,7 @@ int PORT_WriteDataCO(uint16_t handle, int* p_len) { } p_port = &rfc_cb.port.port[handle - 1]; if (!p_port->in_use || (p_port->state == PORT_STATE_CLOSED)) { if (!p_port->in_use || (p_port->state == PORT_CONNECTION_STATE_CLOSED)) { RFCOMM_TRACE_WARNING("PORT_WriteDataByFd() no port state:%d", p_port->state); return (PORT_NOT_OPENED); Loading Loading @@ -1026,12 +1026,12 @@ int PORT_WriteData(uint16_t handle, const char* p_data, uint16_t max_len, } p_port = &rfc_cb.port.port[handle - 1]; if (!p_port->in_use || (p_port->state == PORT_STATE_CLOSED)) { if (!p_port->in_use || (p_port->state == PORT_CONNECTION_STATE_CLOSED)) { RFCOMM_TRACE_WARNING("PORT_WriteData() no port state:%d", p_port->state); return (PORT_NOT_OPENED); } if (p_port->state == PORT_STATE_OPENING) { if (p_port->state == PORT_CONNECTION_STATE_OPENING) { LOG_WARN("Write data received but port is in OPENING state"); } Loading system/stack/rfcomm/port_int.h +4 −4 Original line number Diff line number Diff line Loading @@ -128,10 +128,10 @@ typedef struct { uint8_t handle; // Starting from 1, unique for this object bool in_use; /* True when structure is allocated */ #define PORT_STATE_CLOSED 0 #define PORT_STATE_OPENING 1 #define PORT_STATE_OPENED 2 #define PORT_STATE_CLOSING 3 #define PORT_CONNECTION_STATE_CLOSED 0 #define PORT_CONNECTION_STATE_OPENING 1 #define PORT_CONNECTION_STATE_OPENED 2 #define PORT_CONNECTION_STATE_CLOSING 3 uint8_t state; /* State of the application */ Loading system/stack/rfcomm/port_rfc.cc +6 −6 Original line number Diff line number Diff line Loading @@ -409,7 +409,7 @@ void PORT_ParNegCnf(tRFC_MCB* p_mcb, uint8_t dlci, uint16_t mtu, uint8_t cl, port_get_credits(p_port, k); } if (p_port->state == PORT_STATE_OPENING) if (p_port->state == PORT_CONNECTION_STATE_OPENING) RFCOMM_DlcEstablishReq(p_mcb, p_port->dlci, p_port->mtu); } Loading Loading @@ -464,7 +464,7 @@ void PORT_DlcEstablishInd(tRFC_MCB* p_mcb, uint8_t dlci, uint16_t mtu) { 1); } p_port->state = PORT_STATE_OPENED; p_port->state = PORT_CONNECTION_STATE_OPENED; } /******************************************************************************* Loading Loading @@ -510,7 +510,7 @@ void PORT_DlcEstablishCnf(tRFC_MCB* p_mcb, uint8_t dlci, uint16_t mtu, RFCOMM_CONNECTION_SUCCESS_CNF, 1); } p_port->state = PORT_STATE_OPENED; p_port->state = PORT_CONNECTION_STATE_OPENED; /* RPN is required only if we want to tell DTE how the port should be opened */ Loading Loading @@ -979,7 +979,7 @@ void port_rfc_closed(tPORT* p_port, uint8_t res) { uint32_t events = 0; tRFC_MCB* p_mcb = p_port->rfc.p_mcb; if ((p_port->state == PORT_STATE_OPENING) && (p_port->is_server)) { if ((p_port->state == PORT_CONNECTION_STATE_OPENING) && (p_port->is_server)) { /* The server side was not informed that connection is up, ignore */ RFCOMM_TRACE_WARNING("port_rfc_closed in OPENING state ignored"); Loading @@ -1002,8 +1002,8 @@ void port_rfc_closed(tPORT* p_port, uint8_t res) { return; } if ((p_port->state != PORT_STATE_CLOSING) && (p_port->state != PORT_STATE_CLOSED)) { if ((p_port->state != PORT_CONNECTION_STATE_CLOSING) && (p_port->state != PORT_CONNECTION_STATE_CLOSED)) { p_port->line_status |= LINE_STATUS_FAILED; old_signals = p_port->peer_ctrl.modem_signal; Loading system/stack/rfcomm/port_utils.cc +2 −2 Original line number Diff line number Diff line Loading @@ -222,7 +222,7 @@ void port_release_port(tPORT* p_port) { alarm_cancel(p_port->rfc.port_timer); p_port->state = PORT_STATE_CLOSED; p_port->state = PORT_CONNECTION_STATE_CLOSED; if (p_port->rfc.state == RFC_STATE_CLOSED) { if (p_port->rfc.p_mcb) { Loading Loading @@ -258,7 +258,7 @@ void port_release_port(tPORT* p_port) { p_port->user_port_pars = user_port_pars; p_port->mtu = p_port->keep_mtu; p_port->state = PORT_STATE_OPENING; p_port->state = PORT_CONNECTION_STATE_OPENING; p_port->rfc.p_mcb = nullptr; if (p_port->is_server) p_port->dlci &= 0xfe; Loading system/stack/rfcomm/rfc_port_if.cc +3 −3 Original line number Diff line number Diff line Loading @@ -246,7 +246,7 @@ void RFCOMM_ControlReq(tRFC_MCB* p_mcb, uint8_t dlci, tPORT_CTRL* p_pars) { return; } if ((p_port->state != PORT_STATE_OPENED) || if ((p_port->state != PORT_CONNECTION_STATE_OPENED) || (p_port->rfc.state != RFC_STATE_OPENED)) return; Loading Loading @@ -274,7 +274,7 @@ void RFCOMM_FlowReq(tRFC_MCB* p_mcb, uint8_t dlci, bool enable) { return; } if ((p_port->state != PORT_STATE_OPENED) || if ((p_port->state != PORT_CONNECTION_STATE_OPENED) || (p_port->rfc.state != RFC_STATE_OPENED)) return; Loading @@ -301,7 +301,7 @@ void RFCOMM_LineStatusReq(tRFC_MCB* p_mcb, uint8_t dlci, uint8_t status) { return; } if ((p_port->state != PORT_STATE_OPENED) || if ((p_port->state != PORT_CONNECTION_STATE_OPENED) || (p_port->rfc.state != RFC_STATE_OPENED)) return; Loading Loading
system/stack/rfcomm/port_api.cc +18 −18 Original line number Diff line number Diff line Loading @@ -200,7 +200,7 @@ int RFCOMM_CreateConnection(uint16_t uuid, uint8_t scn, bool is_server, } // Assign port specific values p_port->state = PORT_STATE_OPENING; p_port->state = PORT_CONNECTION_STATE_OPENING; p_port->uuid = uuid; p_port->is_server = is_server; p_port->scn = scn; Loading Loading @@ -267,12 +267,12 @@ int RFCOMM_RemoveConnection(uint16_t handle) { } p_port = &rfc_cb.port.port[handle - 1]; if (!p_port->in_use || (p_port->state == PORT_STATE_CLOSED)) { if (!p_port->in_use || (p_port->state == PORT_CONNECTION_STATE_CLOSED)) { RFCOMM_TRACE_EVENT("RFCOMM_RemoveConnection() Not opened:%d", handle); return (PORT_SUCCESS); } p_port->state = PORT_STATE_CLOSING; p_port->state = PORT_CONNECTION_STATE_CLOSING; port_start_close(p_port); Loading @@ -299,7 +299,7 @@ int RFCOMM_RemoveServer(uint16_t handle) { /* Do not report any events to the client any more. */ p_port->p_mgmt_callback = nullptr; if (!p_port->in_use || (p_port->state == PORT_STATE_CLOSED)) { if (!p_port->in_use || (p_port->state == PORT_CONNECTION_STATE_CLOSED)) { VLOG(1) << __func__ << ": handle " << handle << " not opened"; return (PORT_SUCCESS); } Loading @@ -307,7 +307,7 @@ int RFCOMM_RemoveServer(uint16_t handle) { /* this port will be deallocated after closing */ p_port->keep_port_handle = false; p_port->state = PORT_STATE_CLOSING; p_port->state = PORT_CONNECTION_STATE_CLOSING; port_start_close(p_port); Loading Loading @@ -339,7 +339,7 @@ int PORT_SetEventCallback(uint16_t port_handle, tPORT_CALLBACK* p_port_cb) { p_port = &rfc_cb.port.port[port_handle - 1]; if (!p_port->in_use || (p_port->state == PORT_STATE_CLOSED)) { if (!p_port->in_use || (p_port->state == PORT_CONNECTION_STATE_CLOSED)) { return (PORT_NOT_OPENED); } Loading Loading @@ -399,7 +399,7 @@ int PORT_SetDataCOCallback(uint16_t port_handle, p_port = &rfc_cb.port.port[port_handle - 1]; if (!p_port->in_use || (p_port->state == PORT_STATE_CLOSED)) { if (!p_port->in_use || (p_port->state == PORT_CONNECTION_STATE_CLOSED)) { return (PORT_NOT_OPENED); } Loading Loading @@ -431,7 +431,7 @@ int PORT_SetEventMask(uint16_t port_handle, uint32_t mask) { p_port = &rfc_cb.port.port[port_handle - 1]; if (!p_port->in_use || (p_port->state == PORT_STATE_CLOSED)) { if (!p_port->in_use || (p_port->state == PORT_CONNECTION_STATE_CLOSED)) { return (PORT_NOT_OPENED); } Loading Loading @@ -466,7 +466,7 @@ int PORT_CheckConnection(uint16_t handle, RawAddress* bd_addr, (p_port->rfc.p_mcb ? p_port->rfc.p_mcb->peer_ready : -1), p_port->rfc.state); if (!p_port->in_use || (p_port->state == PORT_STATE_CLOSED)) { if (!p_port->in_use || (p_port->state == PORT_CONNECTION_STATE_CLOSED)) { return (PORT_NOT_OPENED); } Loading Loading @@ -551,7 +551,7 @@ int PORT_SetState(uint16_t handle, tPORT_STATE* p_settings) { p_port = &rfc_cb.port.port[handle - 1]; if (!p_port->in_use || (p_port->state == PORT_STATE_CLOSED)) { if (!p_port->in_use || (p_port->state == PORT_CONNECTION_STATE_CLOSED)) { return (PORT_NOT_OPENED); } Loading Loading @@ -596,7 +596,7 @@ int PORT_GetState(uint16_t handle, tPORT_STATE* p_settings) { p_port = &rfc_cb.port.port[handle - 1]; if (!p_port->in_use || (p_port->state == PORT_STATE_CLOSED)) { if (!p_port->in_use || (p_port->state == PORT_CONNECTION_STATE_CLOSED)) { return (PORT_NOT_OPENED); } Loading Loading @@ -636,7 +636,7 @@ int PORT_FlowControl_MaxCredit(uint16_t handle, bool enable) { p_port = &rfc_cb.port.port[handle - 1]; if (!p_port->in_use || (p_port->state == PORT_STATE_CLOSED)) { if (!p_port->in_use || (p_port->state == PORT_CONNECTION_STATE_CLOSED)) { return (PORT_NOT_OPENED); } Loading Loading @@ -707,12 +707,12 @@ int PORT_ReadData(uint16_t handle, char* p_data, uint16_t max_len, p_port = &rfc_cb.port.port[handle - 1]; if (!p_port->in_use || (p_port->state == PORT_STATE_CLOSED)) { if (!p_port->in_use || (p_port->state == PORT_CONNECTION_STATE_CLOSED)) { return (PORT_NOT_OPENED); } if (p_port->state == PORT_STATE_OPENING) { LOG_WARN("Trying to read a port in PORT_STATE_OPENING state"); if (p_port->state == PORT_CONNECTION_STATE_OPENING) { LOG_WARN("Trying to read a port in PORT_CONNECTION_STATE_OPENING state"); } if (p_port->line_status) { Loading Loading @@ -867,7 +867,7 @@ int PORT_WriteDataCO(uint16_t handle, int* p_len) { } p_port = &rfc_cb.port.port[handle - 1]; if (!p_port->in_use || (p_port->state == PORT_STATE_CLOSED)) { if (!p_port->in_use || (p_port->state == PORT_CONNECTION_STATE_CLOSED)) { RFCOMM_TRACE_WARNING("PORT_WriteDataByFd() no port state:%d", p_port->state); return (PORT_NOT_OPENED); Loading Loading @@ -1026,12 +1026,12 @@ int PORT_WriteData(uint16_t handle, const char* p_data, uint16_t max_len, } p_port = &rfc_cb.port.port[handle - 1]; if (!p_port->in_use || (p_port->state == PORT_STATE_CLOSED)) { if (!p_port->in_use || (p_port->state == PORT_CONNECTION_STATE_CLOSED)) { RFCOMM_TRACE_WARNING("PORT_WriteData() no port state:%d", p_port->state); return (PORT_NOT_OPENED); } if (p_port->state == PORT_STATE_OPENING) { if (p_port->state == PORT_CONNECTION_STATE_OPENING) { LOG_WARN("Write data received but port is in OPENING state"); } Loading
system/stack/rfcomm/port_int.h +4 −4 Original line number Diff line number Diff line Loading @@ -128,10 +128,10 @@ typedef struct { uint8_t handle; // Starting from 1, unique for this object bool in_use; /* True when structure is allocated */ #define PORT_STATE_CLOSED 0 #define PORT_STATE_OPENING 1 #define PORT_STATE_OPENED 2 #define PORT_STATE_CLOSING 3 #define PORT_CONNECTION_STATE_CLOSED 0 #define PORT_CONNECTION_STATE_OPENING 1 #define PORT_CONNECTION_STATE_OPENED 2 #define PORT_CONNECTION_STATE_CLOSING 3 uint8_t state; /* State of the application */ Loading
system/stack/rfcomm/port_rfc.cc +6 −6 Original line number Diff line number Diff line Loading @@ -409,7 +409,7 @@ void PORT_ParNegCnf(tRFC_MCB* p_mcb, uint8_t dlci, uint16_t mtu, uint8_t cl, port_get_credits(p_port, k); } if (p_port->state == PORT_STATE_OPENING) if (p_port->state == PORT_CONNECTION_STATE_OPENING) RFCOMM_DlcEstablishReq(p_mcb, p_port->dlci, p_port->mtu); } Loading Loading @@ -464,7 +464,7 @@ void PORT_DlcEstablishInd(tRFC_MCB* p_mcb, uint8_t dlci, uint16_t mtu) { 1); } p_port->state = PORT_STATE_OPENED; p_port->state = PORT_CONNECTION_STATE_OPENED; } /******************************************************************************* Loading Loading @@ -510,7 +510,7 @@ void PORT_DlcEstablishCnf(tRFC_MCB* p_mcb, uint8_t dlci, uint16_t mtu, RFCOMM_CONNECTION_SUCCESS_CNF, 1); } p_port->state = PORT_STATE_OPENED; p_port->state = PORT_CONNECTION_STATE_OPENED; /* RPN is required only if we want to tell DTE how the port should be opened */ Loading Loading @@ -979,7 +979,7 @@ void port_rfc_closed(tPORT* p_port, uint8_t res) { uint32_t events = 0; tRFC_MCB* p_mcb = p_port->rfc.p_mcb; if ((p_port->state == PORT_STATE_OPENING) && (p_port->is_server)) { if ((p_port->state == PORT_CONNECTION_STATE_OPENING) && (p_port->is_server)) { /* The server side was not informed that connection is up, ignore */ RFCOMM_TRACE_WARNING("port_rfc_closed in OPENING state ignored"); Loading @@ -1002,8 +1002,8 @@ void port_rfc_closed(tPORT* p_port, uint8_t res) { return; } if ((p_port->state != PORT_STATE_CLOSING) && (p_port->state != PORT_STATE_CLOSED)) { if ((p_port->state != PORT_CONNECTION_STATE_CLOSING) && (p_port->state != PORT_CONNECTION_STATE_CLOSED)) { p_port->line_status |= LINE_STATUS_FAILED; old_signals = p_port->peer_ctrl.modem_signal; Loading
system/stack/rfcomm/port_utils.cc +2 −2 Original line number Diff line number Diff line Loading @@ -222,7 +222,7 @@ void port_release_port(tPORT* p_port) { alarm_cancel(p_port->rfc.port_timer); p_port->state = PORT_STATE_CLOSED; p_port->state = PORT_CONNECTION_STATE_CLOSED; if (p_port->rfc.state == RFC_STATE_CLOSED) { if (p_port->rfc.p_mcb) { Loading Loading @@ -258,7 +258,7 @@ void port_release_port(tPORT* p_port) { p_port->user_port_pars = user_port_pars; p_port->mtu = p_port->keep_mtu; p_port->state = PORT_STATE_OPENING; p_port->state = PORT_CONNECTION_STATE_OPENING; p_port->rfc.p_mcb = nullptr; if (p_port->is_server) p_port->dlci &= 0xfe; Loading
system/stack/rfcomm/rfc_port_if.cc +3 −3 Original line number Diff line number Diff line Loading @@ -246,7 +246,7 @@ void RFCOMM_ControlReq(tRFC_MCB* p_mcb, uint8_t dlci, tPORT_CTRL* p_pars) { return; } if ((p_port->state != PORT_STATE_OPENED) || if ((p_port->state != PORT_CONNECTION_STATE_OPENED) || (p_port->rfc.state != RFC_STATE_OPENED)) return; Loading Loading @@ -274,7 +274,7 @@ void RFCOMM_FlowReq(tRFC_MCB* p_mcb, uint8_t dlci, bool enable) { return; } if ((p_port->state != PORT_STATE_OPENED) || if ((p_port->state != PORT_CONNECTION_STATE_OPENED) || (p_port->rfc.state != RFC_STATE_OPENED)) return; Loading @@ -301,7 +301,7 @@ void RFCOMM_LineStatusReq(tRFC_MCB* p_mcb, uint8_t dlci, uint8_t status) { return; } if ((p_port->state != PORT_STATE_OPENED) || if ((p_port->state != PORT_CONNECTION_STATE_OPENED) || (p_port->rfc.state != RFC_STATE_OPENED)) return; Loading