Site Tools


SDK Script status.are

status.are
/* DESC: This script can be used to display all status variables
 * Copyright (C) 2012 NetModule AG, Switzerland
 */
 
sections = mkstruct (
    "summary",   "Short status summary",
    "system",    "System information",
    "license",   "License information",
    "wwan",      "WWAN module status",
    "wlan",      "WLAN module status",
    "gnss",      "GNSS (GPS) module status",
    "lan",       "LAN interface status",
    "wan",       "WAN interface status",
    "openvpn",   "OpenVPN connection status",
    "ipsec",     "IPsec connection status",
    "dio",       "Digital IO status"
);
 
sectlist = struct_fields(sections);
 
for (i = 0; i < length(sectlist); i++) {
    sect = sectlist[i];
    if (strlen(sect) == 0) continue;
 
    /* check if user specified a section */
    if (argc > 1 && argv[1] != sect) continue;
 
    info = struct_get(sections, sect);
    printf("getting status for %s (%s)\n", sect, info);
 
    status = nb_status(sect);
    stlist = struct_fields(status);
 
    for (j = 0; j < length(stlist); j++) {
        key = stlist[j];
        if (strlen(key) > 0) {
            value = struct_get(status, key);
            printf("%s: %s\n", key, value);
        }
    }
    printf("\n\n");
}