Status display
Alows to show status of current channels and users
This commit is contained in:
@@ -182,12 +182,29 @@ const char *cnetz_state_name(enum cnetz_state state)
|
||||
return invalid;
|
||||
}
|
||||
|
||||
void cnetz_display_status(void)
|
||||
{
|
||||
sender_t *sender;
|
||||
cnetz_t *cnetz;
|
||||
transaction_t *trans;
|
||||
|
||||
display_status_start();
|
||||
for (sender = sender_head; sender; sender = sender->next) {
|
||||
cnetz = (cnetz_t *) sender;
|
||||
display_status_channel(cnetz->sender.kanal, chan_type_short_name(cnetz->chan_type), cnetz_state_name(cnetz->state));
|
||||
for (trans = cnetz->trans_list; trans; trans = trans->next)
|
||||
display_status_subscriber(transaction2rufnummer(trans), trans_short_state_name(trans->state));
|
||||
}
|
||||
display_status_end();
|
||||
}
|
||||
|
||||
static void cnetz_new_state(cnetz_t *cnetz, enum cnetz_state new_state)
|
||||
{
|
||||
if (cnetz->state == new_state)
|
||||
return;
|
||||
PDEBUG_CHAN(DCNETZ, DEBUG_INFO, "State change: %s -> %s\n", cnetz_state_name(cnetz->state), cnetz_state_name(new_state));
|
||||
cnetz->state = new_state;
|
||||
cnetz_display_status();
|
||||
}
|
||||
|
||||
/* Convert ISDN cause to 'Ausloesegrund' of C-Netz mobile station */
|
||||
|
@@ -138,4 +138,5 @@ const struct telegramm *cnetz_transmit_telegramm_spk_k(cnetz_t *cnetz);
|
||||
void cnetz_receive_telegramm_spk_k(cnetz_t *cnetz, struct telegramm *telegramm);
|
||||
const struct telegramm *cnetz_transmit_telegramm_spk_v(cnetz_t *cnetz);
|
||||
void cnetz_receive_telegramm_spk_v(cnetz_t *cnetz, struct telegramm *telegramm);
|
||||
void cnetz_display_status(void);
|
||||
|
||||
|
@@ -109,6 +109,7 @@ void link_transaction(transaction_t *trans, cnetz_t *cnetz)
|
||||
while (*transp)
|
||||
transp = &((*transp)->next);
|
||||
*transp = trans;
|
||||
cnetz_display_status();
|
||||
}
|
||||
|
||||
/* unlink transaction from list */
|
||||
@@ -127,6 +128,7 @@ void unlink_transaction(transaction_t *trans)
|
||||
}
|
||||
*transp = trans->next;
|
||||
trans->cnetz = NULL;
|
||||
cnetz_display_status();
|
||||
}
|
||||
|
||||
transaction_t *search_transaction(cnetz_t *cnetz, uint32_t state_mask)
|
||||
@@ -226,10 +228,46 @@ static const char *trans_state_name(int state)
|
||||
}
|
||||
}
|
||||
|
||||
const char *trans_short_state_name(int state)
|
||||
{
|
||||
switch (state) {
|
||||
case 0:
|
||||
return "IDLE";
|
||||
case TRANS_EM:
|
||||
case TRANS_UM:
|
||||
return "REGISTER";
|
||||
case TRANS_MA:
|
||||
case TRANS_MFT:
|
||||
return "PING";
|
||||
case TRANS_VWG:
|
||||
case TRANS_WAF:
|
||||
case TRANS_WBP:
|
||||
case TRANS_WBN:
|
||||
return "DIALING";
|
||||
case TRANS_VAG:
|
||||
case TRANS_VAK:
|
||||
case TRANS_BQ:
|
||||
case TRANS_VHQ:
|
||||
return "ASSIGN";
|
||||
case TRANS_RTA:
|
||||
return "ALERT";
|
||||
case TRANS_DS:
|
||||
return "DS";
|
||||
case TRANS_AHQ:
|
||||
return "AHQ";
|
||||
case TRANS_AF:
|
||||
case TRANS_AT:
|
||||
return "RELEASE";
|
||||
default:
|
||||
return "<invald transaction state>";
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
cnetz_display_status();
|
||||
}
|
||||
|
||||
void cnetz_flush_other_transactions(cnetz_t *cnetz, transaction_t *trans)
|
||||
|
@@ -54,4 +54,5 @@ transaction_t *search_transaction_callref(cnetz_t *cnetz, int callref);
|
||||
void trans_new_state(transaction_t *trans, int state);
|
||||
void cnetz_flush_other_transactions(cnetz_t *cnetz, transaction_t *trans);
|
||||
void transaction_timeout(struct timer *timer);
|
||||
const char *trans_short_state_name(int state);
|
||||
|
||||
|
Reference in New Issue
Block a user