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

Commit d427641e authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "legacy: Rename PORT_STATE_ => PORT_CONNECTION_STATE_"

parents 0d7a2baf 00a2ea10
Loading
Loading
Loading
Loading
+18 −18
Original line number Diff line number Diff line
@@ -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;
@@ -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);

@@ -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);
  }
@@ -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);

@@ -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);
  }

@@ -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);
  }

@@ -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);
  }

@@ -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);
  }

@@ -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);
  }

@@ -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);
  }

@@ -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);
  }

@@ -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) {
@@ -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);
@@ -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");
  }

+4 −4
Original line number Diff line number Diff line
@@ -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 */

+6 −6
Original line number Diff line number Diff line
@@ -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);
}

@@ -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;
}

/*******************************************************************************
@@ -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
   */
@@ -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");

@@ -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;
+2 −2
Original line number Diff line number Diff line
@@ -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) {
@@ -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;

+3 −3
Original line number Diff line number Diff line
@@ -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;

@@ -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;

@@ -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;