void display_system_message(ui_t *ui, char *msg) { ui_history_add(log_history, msg, MSG_SYSTEM); display_status_message(ui, msg , COL_SYS); }
int c_info( int argc, char *argv[] ) { extern int usage(), get_status(); struct tm *tms; int expire; char error_msg[127]; if (argc != 2) usage(E_2MANY); if ( configp->device_type & DEV_DUMMY ) { printf("Heyu version %s\n", VERSION); printf("Configuration at %s\n", pathspec(heyu_config)); printf("Dummy powerline interface (TTY %s)\n", configp->tty); if ( configp->ttyaux[0] ) printf("Auxiliary RF interface on %s\n", configp->ttyaux); if ( configp->ttyrfxmit[0] ) { printf("%sMHz RFXmitter on %s\n", ((configp->rfxmit_freq == MHZ310) ? "310" : "433"), configp->ttyrfxmit); } return 0; } if ( configp->device_type & DEV_CM10A ) { printf("Heyu version %s\n", VERSION); printf("Configuration at %s\n", pathspec(heyu_config)); printf("Powerline interface CM10A on %s\n", configp->tty); if ( configp->ttyaux[0] ) printf("Auxiliary RF interface on %s\n", configp->ttyaux); if ( configp->ttyrfxmit[0] ) { printf("%sMHz RFXmitter on %s\n", ((configp->rfxmit_freq == MHZ310) ? "310" : "433"), configp->ttyrfxmit); } return 0; } if ( get_status() < 0 ) { sprintf(error_msg, "No response from the CM11A on %s\nProgram exiting.", configp->tty); error(error_msg); } printf("Heyu version %s\n", VERSION); printf("Configuration at %s\n", pathspec(heyu_config)); printf("Powerline interface on %s\n", configp->tty); if ( configp->ttyaux[0] ) printf("Auxiliary RF interface on %s\n", configp->ttyaux); if ( configp->ttyrfxmit[0] ) { printf("%sMHz RFXmitter on %s\n", ((configp->rfxmit_freq == MHZ310) ? "310" : "433"), configp->ttyrfxmit); } printf("Firmware revision Level = %d\n", Irev ); /* Display CM11a battery timer */ if ( Ibattery == 0xFFFF ) (void) printf("Interface battery usage = Unknown\n"); else (void) printf("Interface battery usage = %d:%02d (hh:mm)\n", Ibattery / 60, Ibattery % 60); if ((Ihours + Iminutes + Idays + Ijday) != 0 ) { (void) printf("Raw interface clock: %s, Day %03d, %02d:%02d:%02d\n", bmap2ascdow(Idays), Ijday, Ihours, Iminutes, Iseconds); tms = cm11a_to_legal(&Idays, &Ijday, &Ihours, &Iminutes, &Iseconds, &expire); if ( expire != BAD_RECORD_FILE ) { (void) printf("(--> Civil Time: %s %02d %s %d %02d:%02d:%02d %s)\n", bmap2ascdow(Idays), tms->tm_mday, month_name[tms->tm_mon], tms->tm_year + 1900, tms->tm_hour, tms->tm_min, tms->tm_sec, heyu_tzname[tms->tm_isdst]); } display_status_message( expire ); } else (void) printf("Interface clock not yet set\n"); (void) printf("Housecode = %c\n", code2hc(Ihcode)); (void) printf("0 = off, 1 = on, unit 16.......8...4..1\n"); (void) printf("Last addressed device = 0x%04x (%s)\n", Iaddmon, bmap2rasc(Iaddmon, "01") ); (void) printf("Status of monitored devices = 0x%04x (%s)\n", Istatmon, bmap2rasc(Istatmon, "01") ); (void) printf("Status of dimmed devices = 0x%04x (%s)\n", Istatdim, bmap2rasc(Istatdim, "01") ); return(0); }