FreeCalypso > hg > freecalypso-hwlab
diff simtool/hlread.c @ 103:90eff13a72fd
fc-simtool: implemented alpha field decoding and spn command
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Mon, 25 Jan 2021 04:54:47 +0000 |
parents | 597c4e87a1f4 |
children |
line wrap: on
line diff
--- a/simtool/hlread.c Mon Jan 25 02:16:16 2021 +0000 +++ b/simtool/hlread.c Mon Jan 25 04:54:47 2021 +0000 @@ -92,3 +92,35 @@ printf("%s parity=%c len=%u\n", buf + 1, buf[0], sim_resp_data[0]); return(0); } + +cmd_spn() +{ + int rc; + unsigned textlen; + + rc = select_op(DF_GSM); + if (rc < 0) + return(rc); + rc = select_op(EF_SPN); + if (rc < 0) + return(rc); + rc = parse_ef_select_response(); + if (rc < 0) + return(rc); + if (curfile_structure != 0x00 || curfile_total_size != 17) { + fprintf(stderr, "error: expected transparent EF of 17 bytes\n"); + return(-1); + } + rc = readbin_op(0, 17); + if (rc < 0) + return(rc); + printf("Display condition: %02X\n", sim_resp_data[0]); + printf("SPN: "); + rc = validate_alpha_field(sim_resp_data + 1, 16, &textlen); + if (rc >= 0) + print_alpha_field(sim_resp_data, textlen, stdout); + else + printf("malformed alpha field"); + putchar('\n'); + return(0); +}