/* these commands require PIN to be READY */ int gsmd_initsettings_after_pin(struct gsmd *gsmd) { int rc = 0; /* enable +CREG: unsolicited response if registration status changes */ rc |= gsmd_simplecmd(gsmd, "AT+CREG=2"); /* use +CRING instead of RING */ rc |= gsmd_simplecmd(gsmd, "AT+CRC=1"); /* use +CLIP: to indicate CLIP */ rc |= gsmd_simplecmd(gsmd, "AT+CLIP=1"); /* use +COLP: to indicate COLP */ /* set it 0 to disable subscriber info and avoid cme err 512 ?FIXME? */ rc |= gsmd_simplecmd(gsmd, "AT+COLP=1"); /* use +CCWA: to indicate waiting call */ rc |= gsmd_simplecmd(gsmd, "AT+CCWA=1"); /* activate the unsolicited reporting of CCM value */ rc |= gsmd_simplecmd(gsmd, "AT+CAOC=2"); /* get imsi */ atcmd_submit(gsmd, atcmd_fill("AT+CIMI", 0, &gsmd_get_imsi_cb, gsmd, 0, NULL)); sms_cb_init(g_slow); if (gsmd->vendorpl && gsmd->vendorpl->initsettings_after_pin) return gsmd->vendorpl->initsettings_after_pin(gsmd); else return rc; }
static int sim_notification_cmd(struct gsmd *gsmd, int retries, int retry_delay) { struct gsmd_atcmd *cmd; int retval = 0; int notif_channel = GSMD_CMD_CHANNEL0; cmd = atcmd_fill("AT+CSMS=1", 9+1, &sim_notification_cb, gsmd, NULL); if (!cmd) return -ENOMEM; cmd->timeout_value = 10; cmd->flags |= ATCMD_PIN_SENSITIVE; cmd->cmd_retries = retries; cmd->initial_delay_secs = retry_delay; if (gsmd->number_channels > GSMD_NOTIFS_CHANNEL) notif_channel = GSMD_NOTIFS_CHANNEL; if (retries) { /* high priority to ensure the retried cmd goes at start of the pending list */ retval = atcmd_submit_highpriority(gsmd, cmd, notif_channel); } else { retval = atcmd_submit(gsmd, cmd, notif_channel); } return retval; }
static int ticalypso_initsettings(struct gsmd *g) { int rc = 0; struct gsmd_atcmd *cmd; /* use +CTZR: to report time zone changes */ rc |= gsmd_simplecmd(g, "AT+CTZR=1"); /* use %CTZV: Report time and date */ rc |= gsmd_simplecmd(g, "AT%CTZV=1"); /* use %CGREG */ //rc |= gsmd_simplecmd(g, "AT%CGREG=3"); /* enable %CPRI: ciphering indications */ rc |= gsmd_simplecmd(g, "AT%CPRI=1"); /* enable %CSQ: signal quality reports */ rc |= gsmd_simplecmd(g, "AT%CSQ=1"); /* send unsolicited commands at any time */ rc |= gsmd_simplecmd(g, "AT%CUNS=0"); /* enable %CPI: call progress indication */ cmd = atcmd_fill("AT%CPI=?", 9, &cpi_detect_cb, g, 0, NULL); if (cmd) atcmd_submit(g, cmd); return rc; }
int gsmd_simplecmd(struct gsmd *gsmd, char *cmdtxt) { struct gsmd_atcmd *cmd; cmd = atcmd_fill(cmdtxt, 0, &gsmd_test_atcb, NULL, 0, NULL); if (!cmd) return -ENOMEM; return atcmd_submit(gsmd, cmd); }
int query_network_status(struct gsmd *gsmd) { struct gsmd_atcmd *cmd; cmd = atcmd_fill("AT+CREG?", 8+1, &query_network_cb, gsmd, NULL); if (!cmd) return -ENOMEM; cmd->timeout_value = 10; /* in case modem is slow */ return atcmd_submit(gsmd, cmd, GSMD_CMD_CHANNEL0); }
int gsmd_initsettings(struct gsmd *gsmd) { struct gsmd_atcmd *cmd; cmd = atcmd_fill("ATZ", 0, &firstcmd_atcb, gsmd, 0, NULL); if (!cmd) return -ENOMEM; return atcmd_submit(gsmd, cmd); }
int gsmd_initsettings_slow(struct gsmd *gsmd) { int rc = 0; if (gsmd->vendorpl && gsmd->vendorpl->initsettings_slow) rc |= gsmd->vendorpl->initsettings_slow(gsmd); /* get PIN status */ atcmd_submit(gsmd, atcmd_fill("AT+CPIN?", 0, &gsmd_get_cpin_cb, gsmd, 0, NULL)); return rc; }
static int gsmd_modem_alive(struct gsmd *gsmd) { struct gsmd_atcmd *cmd; gsmd->alive_responded = 0; cmd = atcmd_fill(GSMD_ALIVECMD, -1, &gsmd_alive_cb, gsmd, 0, alive_timer); if (!cmd) { return -ENOMEM; } return atcmd_submit(gsmd, cmd); }
static void check_channel(struct gsmd *gsmd, u_int8_t channel) { struct gsmd_atcmd *cmd = atcmd_fill("AT", 3, &check_channel_cb, gsmd, NULL); if (cmd) atcmd_submit_highpriority(gsmd, cmd, channel); }