const RIL_RadioFunctions *RIL_Init(const struct RIL_Env *env, int argc, char **argv) ret = pthread_create(&s_tid_mainloop, &attr, mainLoop, NULL); static void *mainLoop(void *param) ret = at_open(fd, onUnsolicited); RIL_requestTimedCallback(initializeCallback, NULL, &TIMEVAL_0);
static void initializeCallback(void *param)
{
ATResponse *p_response = NULL;
int err;
setRadioState (RADIO_STATE_OFF);
at_handshake();
/* note: we don't check errors here. Everything important will
be handled in onATTimeout and onATReaderClosed */
/* atchannel is tolerant of echo but it must */
/* have verbose result codes */
at_send_command("ATE0Q0V1", NULL);
/* No auto-answer */
at_send_command("ATS0=0", NULL);
/* Extended errors */
at_send_command("AT+CMEE=1", NULL);
/* Network registration events */
err = at_send_command("AT+CREG=2", &p_response);
/* some handsets -- in tethered mode -- don't support CREG=2 */
if (err < 0 || p_response->success == 0) {
at_send_command("AT+CREG=1", NULL);
}
at_response_free(p_response);
/* GPRS registration events */
at_send_command("AT+CGREG=1", NULL);
/* Call Waiting notifications */
at_send_command("AT+CCWA=1", NULL);
/* Alternating voice/data off */
at_send_command("AT+CMOD=0", NULL);
/* Not muted */
at_send_command("AT+CMUT=0", NULL);
/* +CSSU unsolicited supp service notifications */
at_send_command("AT+CSSN=0,1", NULL);
/* no connected line identification */
at_send_command("AT+COLP=0", NULL);
/* HEX character set */
at_send_command("AT+CSCS=\"HEX\"", NULL);
/* USSD unsolicited */
at_send_command("AT+CUSD=1", NULL);
/* Enable +CGEV GPRS event notifications, but don't buffer */
at_send_command("AT+CGEREP=1,0", NULL);
/* SMS PDU mode */
at_send_command("AT+CMGF=0", NULL);
#ifdef USE_TI_COMMANDS
at_send_command("AT%CPI=3", NULL);
/* TI specific -- notifications when SMS is ready (currently ignored) */
at_send_command("AT%CSTAT=1", NULL);
#endif /* USE_TI_COMMANDS */
/* assume radio is off on error */
if (isRadioOn() > 0) {
setRadioState (RADIO_STATE_SIM_NOT_READY);
}
}
static void pollSIMState (void *param)
{
ATResponse *p_response;
int ret;
if (sState != RADIO_STATE_SIM_NOT_READY) {
// no longer valid to poll
return;
}
switch(getSIMStatus()) {
case RIL_SIM_ABSENT:
case RIL_SIM_PIN:
case RIL_SIM_PUK:
case RIL_SIM_NETWORK_PERSONALIZATION:
default:
setRadioState(RADIO_STATE_SIM_LOCKED_OR_ABSENT);
return;
case RIL_SIM_NOT_READY:
RIL_requestTimedCallback (pollSIMState, NULL, &TIMEVAL_SIMPOLL);
return;
case RIL_SIM_READY:
setRadioState(RADIO_STATE_SIM_READY);
return;
}
}
err = at_send_command_singleline("AT+CPIN?", "+CPIN:", &p_response);
at_send_command_singleline("AT+CSMS=1", "+CSMS:", NULL);
at_send_command("AT+CNMI=1,2,2,1,1", NULL);
public void systemReady() {
mPolicy.systemReady();
}
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有