Status display
Alows to show status of current channels and users
This commit is contained in:
@@ -272,12 +272,29 @@ const char *amps_state_name(enum amps_state state)
|
||||
return invalid;
|
||||
}
|
||||
|
||||
void amps_display_status(void)
|
||||
{
|
||||
sender_t *sender;
|
||||
amps_t *amps;
|
||||
transaction_t *trans;
|
||||
|
||||
display_status_start();
|
||||
for (sender = sender_head; sender; sender = sender->next) {
|
||||
amps = (amps_t *) sender;
|
||||
display_status_channel(amps->sender.kanal, chan_type_short_name(amps->chan_type), amps_state_name(amps->state));
|
||||
for (trans = amps->trans_list; trans; trans = trans->next)
|
||||
display_status_subscriber(amps_min2number(trans->min1, trans->min2), trans_short_state_name(trans->state));
|
||||
}
|
||||
display_status_end();
|
||||
}
|
||||
|
||||
static void amps_new_state(amps_t *amps, enum amps_state new_state)
|
||||
{
|
||||
if (amps->state == new_state)
|
||||
return;
|
||||
PDEBUG_CHAN(DAMPS, DEBUG_DEBUG, "State change: %s -> %s\n", amps_state_name(amps->state), amps_state_name(new_state));
|
||||
amps->state = new_state;
|
||||
amps_display_status();
|
||||
}
|
||||
|
||||
static struct amps_channels {
|
||||
|
@@ -174,4 +174,5 @@ void amps_rx_sat(amps_t *amps, int tone, double quality);
|
||||
void amps_rx_recc(amps_t *amps, uint8_t scm, uint8_t mpci, uint32_t esn, uint32_t min1, uint16_t min2, uint8_t msg_type, uint8_t ordq, uint8_t order, const char *dialing);
|
||||
transaction_t *amps_tx_frame_focc(amps_t *amps);
|
||||
transaction_t *amps_tx_frame_fvc(amps_t *amps);
|
||||
void amps_display_status();
|
||||
|
||||
|
@@ -68,6 +68,39 @@ static const char *trans_state_name(int state)
|
||||
}
|
||||
}
|
||||
|
||||
const char *trans_short_state_name(int state)
|
||||
{
|
||||
switch (state) {
|
||||
case 0:
|
||||
return "IDLE";
|
||||
case TRANS_REGISTER_ACK:
|
||||
case TRANS_REGISTER_ACK_SEND:
|
||||
return "REGISTER";
|
||||
case TRANS_CALL_MO_ASSIGN:
|
||||
case TRANS_CALL_MO_ASSIGN_SEND:
|
||||
case TRANS_CALL_MT_ASSIGN:
|
||||
case TRANS_CALL_MT_ASSIGN_SEND:
|
||||
return "ASSIGN";
|
||||
case TRANS_CALL_MT_ALERT:
|
||||
case TRANS_CALL_MT_ALERT_SEND:
|
||||
return "ALERT";
|
||||
case TRANS_CALL_REJECT:
|
||||
case TRANS_CALL_REJECT_SEND:
|
||||
return "REJECT";
|
||||
case TRANS_CALL:
|
||||
return "CALL";
|
||||
case TRANS_CALL_RELEASE:
|
||||
case TRANS_CALL_RELEASE_SEND:
|
||||
return "RELEASE";
|
||||
case TRANS_PAGE:
|
||||
case TRANS_PAGE_SEND:
|
||||
case TRANS_PAGE_REPLY:
|
||||
return "PAGE";
|
||||
default:
|
||||
return "<invald transaction state>";
|
||||
}
|
||||
}
|
||||
|
||||
/* create transaction */
|
||||
transaction_t *create_transaction(amps_t *amps, enum amps_trans_state state, uint32_t min1, uint16_t min2, uint8_t msg_type, uint8_t ordq, uint8_t order, uint16_t chan)
|
||||
{
|
||||
@@ -139,6 +172,7 @@ void link_transaction(transaction_t *trans, amps_t *amps)
|
||||
while (*transp)
|
||||
transp = &((*transp)->next);
|
||||
*transp = trans;
|
||||
amps_display_status();
|
||||
}
|
||||
|
||||
/* unlink transaction from list */
|
||||
@@ -157,6 +191,7 @@ void unlink_transaction(transaction_t *trans)
|
||||
}
|
||||
*transp = trans->next;
|
||||
trans->amps = NULL;
|
||||
amps_display_status();
|
||||
}
|
||||
|
||||
transaction_t *search_transaction_number(amps_t *amps, uint32_t min1, uint16_t min2)
|
||||
@@ -199,6 +234,7 @@ void trans_new_state(transaction_t *trans, int state)
|
||||
{
|
||||
PDEBUG(DTRANS, DEBUG_INFO, "Transaction state %s -> %s\n", trans_state_name(trans->state), trans_state_name(state));
|
||||
trans->state = state;
|
||||
amps_display_status();
|
||||
}
|
||||
|
||||
void amps_flush_other_transactions(amps_t *amps, transaction_t *trans)
|
||||
|
@@ -49,4 +49,5 @@ transaction_t *search_transaction_callref(amps_t *amps, int callref);
|
||||
void trans_new_state(transaction_t *trans, int state);
|
||||
void amps_flush_other_transactions(amps_t *amps, transaction_t *trans);
|
||||
void transaction_timeout(struct timer *timer);
|
||||
const char *trans_short_state_name(int state);
|
||||
|
||||
|
Reference in New Issue
Block a user