Пример #1
0
void at(int fd) {
    sendAt(fd);
    for (;;) {
        if(readResp(fd) != 0) {
            if(strstr((const char *)readbuf,"OK") != NULL) {
                break;
            }
        }
        sendAt(fd);
    }
}
Пример #2
0
menix::menix(QWidget *parent) :
        QMainWindow(parent),
        m_ui(new Ui::menix) {
    m_ui->setupUi(this);


    QToolBar *toolbarIconos = addToolBar(tr("Iconos"));
    toolbarIconos->addAction(QIcon(":/preferences-system.png"),"Opciones",this,SLOT( abrirOpciones() ) );
    toolbarIconos->addAction(QIcon(":/terminal.png"),"Debug",this,SLOT(abrirDebug()));

    opciones = new opcionesGlobales();
    numero = opciones->NumeroDestino();
    puerto = opciones->Puerto();
    pin = opciones->Pin();
    centro = opciones->CentroMensajes();
    fixok = opciones->Fixok();
    
    ips = new QStringList( opciones->Ips() );

    file = new QFile( opciones->fileLog() );
    file->open( QIODevice::WriteOnly | QIODevice::Text );
    flog = new QTextStream( file );
    
    mensaje = new smsat(centro,puerto,flog,pin,fixok);
    crearAcciones();
    crearBandeja();
//    testPuerto( mensaje );
    Server *tcp = new Server(ips,this);
    connect(tcp,SIGNAL(sendMessage(QString)),this,SLOT(sendMessage(QString)));
    connect(mensaje,SIGNAL(sendAt(QString)),this,SLOT(sendedMessage(QString)));
    connect(mensaje,SIGNAL(displayMsg(QString)),this,SLOT(showPopup(QString)));
}
Пример #3
0
static int eng_simtest_checksim_euicc(int type)
{
    int fd, ret = 0;
    char simstatus;
    char cmd[32];
    char* atchannel, *atrsp;
    int len = 0;
    ENG_LOG("%s: type=%d\n",__FUNCTION__, type);

#ifndef ENG_AT_CHANNEL
    // @alvin: FIX ME: which channel should we use ?
    atchannel = eng_diag_at_channel();
    fd = eng_open_dev(atchannel, O_WRONLY);
    if(fd < 0) {
        ENG_LOG("%s: can't open at channel: %s", __FUNCTION__, atchannel);
    }

    do{
        memset(cmd, 0, sizeof(cmd));
        strcpy(cmd, "at+euicc?\r");
        len = write(fd, cmd, strlen(cmd));
        if(len <= 0){
            continue;
        }
        memset(cmd, 0, sizeof(cmd));
        len = read(fd, cmd, sizeof(cmd));
        if(len <= 0){
            continue;
        }
        ENG_LOG("%s: response=%s\n", __FUNCTION__, cmd);
    }while(strstr(cmd, "err")!=NULL);

    close(fd);
#else // use at channel: modemid=0 & simid=0 is temporary
    atrsp = sendAt(0, 0, "at_euicc?\r");
    memset(cmd, 0, sizeof(cmd));
    strcpy(cmd, atrsp);
#endif
    simstatus = cmd[0];

    if(simstatus=='2') {
        ret=0;
    } else if((simstatus=='0')||(simstatus=='1')) {
        ret = 1;
    }

    return ret;
}